feat: use external aes lib
This commit is contained in:
@@ -254,8 +254,33 @@ async function decryptMessage(key, ciphertext) {
|
||||
iv
|
||||
},
|
||||
key,
|
||||
new Uint8Array(ciphertext)
|
||||
ciphertext
|
||||
)
|
||||
|
||||
return decrypted
|
||||
}
|
||||
|
||||
async function decryptMessage2(key, encryptedBytes) {
|
||||
iv = new Uint8Array([
|
||||
0x00,
|
||||
0x01,
|
||||
0x02,
|
||||
0x03,
|
||||
0x04,
|
||||
0x05,
|
||||
0x06,
|
||||
0x07,
|
||||
0x08,
|
||||
0x09,
|
||||
0x0a,
|
||||
0x0b,
|
||||
0x0c,
|
||||
0x0d,
|
||||
0x0e,
|
||||
0x0f
|
||||
])
|
||||
const aesCbc = new aesjs.ModeOfOperation.cbc(key, iv)
|
||||
const decryptedBytes = aesCbc.decrypt(encryptedBytes)
|
||||
console.log('### decryptedBytes', decryptedBytes)
|
||||
return decryptedBytes
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user