1.0.1 • Published 6 months ago

huawei-modem-encryption v1.0.1

Weekly downloads
-
License
BSD
Repository
-
Last release
6 months ago

šŸ”’ Huawei Modem Encryption

A JavaScript library for RSA encryption used by Huawei modems. This library provides functionality to encrypt passwords and other sensitive data using RSA PKCS#1 with both padding types.

šŸ“¦ Installation

npm install huawei-modem-encryption

šŸš€ Usage

import { doRSAEncrypt } from 'huawei-modem-encryption';

// Example usage:
const encryptedString = doRSAEncrypt(
  "password",        // šŸ”‘ String to encrypt
  publicKeyN,        // šŸ” RSA public key modulus (n)
  publicKeyE,        // šŸ” RSA public key exponent (e) 
  0                  // šŸ”“ Login status is 0 (logged in)
);

šŸ“ Parameters

  • string: The data to be encrypted (e.g., password) šŸ”‘
  • publicKeyN: The RSA public key modulus (n) šŸ”
  • publicKeyE: The RSA public key exponent (e) šŸ”
  • loginStatus: 0 for logged in šŸ”“

Note: The public key (n and e) should be obtained from your Huawei modem's API or documentation.

✨ Features

  • šŸ” RSA encryption with PKCS#1 v1.5 and OAEP padding support
  • šŸ“œ Base64 encoding of encrypted data
  • šŸŽ² Built-in secure random number generation
  • šŸ›”ļø SHA-1 hashing for OAEP padding

šŸ“œ License

BSD License

This package contains code derived from Tom Wu's RSA implementation. Copyright (c) 2005 Tom Wu
All Rights Reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

šŸ‘Øā€šŸ’» Authors

Original Author: Tom Wu
Republished by: Doni Setiawan

šŸ“§ doni.setiawan@salt.co.id

This is a republished version of a Huawei modem encryption implementation.

1.0.1

6 months ago

1.0.0

4 years ago