Skip to content

Commit

Permalink
Merge pull request #880 from Microsoft/toanzian/crypto-fix
Browse files Browse the repository at this point in the history
Changed en/decryption cipher to aes-256-cbc to work with Electron 4+.
  • Loading branch information
benbrown authored Apr 17, 2019
2 parents b6f1f56 + 118786d commit d13a283
Show file tree
Hide file tree
Showing 4 changed files with 9,268 additions and 4,796 deletions.
181 changes: 153 additions & 28 deletions libraries/botbuilder-ai/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions libraries/botframework-config/src/encrypt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function encryptString(plainText: string, secret: string): string {
const ivText: string = ivBytes.toString('base64');

// encrypt using aes256 iv + key + plainText = encryptedText
const cipher: crypto.Cipher = crypto.createCipheriv('aes256', keyBytes, ivBytes);
const cipher: crypto.Cipher = crypto.createCipheriv('aes-256-cbc', keyBytes, ivBytes);
let encryptedValue: string = cipher.update(plainText, 'utf8', 'base64');
encryptedValue += cipher.final('base64');

Expand Down Expand Up @@ -84,7 +84,7 @@ export function decryptString(encryptedValue: string, secret: string): string {
}

// decrypt using aes256 iv + key + encryptedText = decryptedText
const decipher: crypto.Decipher = crypto.createDecipheriv('aes256', keyBytes, ivBytes);
const decipher: crypto.Decipher = crypto.createDecipheriv('aes-256-cbc', keyBytes, ivBytes);
let value: string = decipher.update(encryptedText, 'base64', 'utf8');
value += decipher.final('utf8');

Expand Down
Loading

0 comments on commit d13a283

Please sign in to comment.