1.0.0 • Published 5 years ago

rsa-cmdw v1.0.0

Weekly downloads
1
License
ISC
Repository
-
Last release
5 years ago

rsa-cmdw

rsa-cmdw

NPM 下载包

npm i rsa-cmdw --save-dev

js使用 (加密)

const { RSA, BASE64 } = require('rsa-cmdw');
const RSAAPP = {
    NoPadding: "NoPadding",
    PKCS1Padding: "PKCS1Padding",
    RawEncoding: "RawEncoding",
    NumericEncoding: "NumericEncoding",
};
const userId = '2222';
const pwd = '33333';
const e = "010001";
const m = "0082647e932d96dab18bae257f463abfa351438184585128eb223c2b400ed8f0ec3396cc4da111158879525e03b3931f039b361a0b97ef6c7c12d6389efc37a034d446925337333decb2d1f4e33b83eacd05a2243ced02d5b8966770d934bb999d7036d4bf50895675c144421edf68b9cceafbd11bef67f1aadf9db058ff457ebd";
RSA.setMaxDigits(262);
const key = new RSA.RSAKeyPair(e, "", m, 1024);
const useridtext = BASE64.base64_encode(RSA.encryptedString(key, userId, RSAAPP.PKCS1Padding, RSAAPP.RawEncoding));
const pwdtext = BASE64.base64_encode(RSA.encryptedString(key, pwd, RSAAPP.PKCS1Padding, RSAAPP.RawEncoding));
console.log(useridtext);
console.log(pwdtext);