huawei-modem-encryption v1.0.1
š 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
ande
) 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:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
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.
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.