_getEncryptedPassword() { const { assetPassword, encryptionKey } = this.config; if (!assetPassword || !encryptionKey) { return ''; } const key = Buffer.from(encryptionKey, 'base64'); const iv = randomBytes(16); const cipher = crypto.createCipheriv('aes-256-cbc', key, iv); return `${iv.toString('hex')}${cipher.update(assetPassword, 'utf8', 'hex')}${cipher.final( 'hex' )}`.toUpperCase(); }
return Uint8Array.from(Buffer.concat([ciphertext,cipher.final()])).buffer
return Uint8Array.from(Buffer.concat([cipher.update(data),cipher.final()])).buffer
cipher.setAAD(additionalData) let ciphertext = cipher.update(Buffer.from(data)) ciphertext = Buffer.concat([ciphertext,cipher.final()])
_getEncryptedPassword() { const { assetPassword, encryptionKey } = this.config; if (!assetPassword || !encryptionKey) { return ''; } const key = Buffer.from(encryptionKey, 'base64'); const iv = randomBytes(16); const cipher = crypto.createCipheriv('aes-256-cbc', key, iv); return `${iv.toString('hex')}${cipher.update(assetPassword, 'utf8', 'hex')}${cipher.final( 'hex' )}`.toUpperCase(); }