Initial commit: API Debug Tool
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
20
server/test-rsa.js
Normal file
20
server/test-rsa.js
Normal file
@@ -0,0 +1,20 @@
|
||||
const crypto = require('crypto');
|
||||
const { generateKeyPairSync } = crypto;
|
||||
|
||||
const { privateKey, publicKey } = generateKeyPairSync('rsa', {
|
||||
modulusLength: 2048,
|
||||
publicKeyEncoding: {
|
||||
type: 'spki',
|
||||
format: 'pem'
|
||||
},
|
||||
privateKeyEncoding: {
|
||||
type: 'pkcs8',
|
||||
format: 'pem'
|
||||
}
|
||||
});
|
||||
|
||||
const data = "apiCode=0001&entCode=1&nonce=999×tamp=1565244098737";
|
||||
const sign = crypto.createSign('RSA-MD5');
|
||||
sign.update(data);
|
||||
const signature = sign.sign(privateKey, 'base64');
|
||||
console.log('Signature:', signature);
|
||||
Reference in New Issue
Block a user