Skip to content

Commit 355dee4

Browse files
committed
Pass 3
1 parent 1da63d1 commit 355dee4

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,13 @@ npm i
2727
npm run build
2828
npm run tsrun
2929
```
30+
31+
## Example Output
32+
33+
```
34+
$ npm run tsrun
35+
> [email protected] tsrun /home/davidgarske/GitHub/wolfcrypt_nodejs
36+
> npx tsc main.ts && node main.js
37+
38+
PASS
39+
```

WolfSSLDecryptor.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ export class WolfSSLDecryptor {
5959
* process.
6060
*/
6161
public finalize(): Buffer {
62+
this.totalInputLength += this.totalInputLength % 16;
63+
6264
let outBuffer = Buffer.alloc( this.totalInputLength )
6365

6466
let ret = wolfcrypt.EVP_CipherFinal( this.evp, outBuffer )

main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var WolfSSLDecryptor_1 = require("./WolfSSLDecryptor");
44
var key = Buffer.from('12345678901234567890123456789012');
55
var iv = Buffer.from('1234567890123456');
66
var decrypt = new WolfSSLDecryptor_1.WolfSSLDecryptor('AES-256-CBC', key, iv);
7-
var expected = 'test';
7+
var expected = 'test\0\0\0\0\0\0\0\0\0\0\0\0';
88
var actual = Buffer.concat([
99
decrypt.update(Buffer.from('24d31b1e41fc8c40', 'hex')),
1010
decrypt.update(Buffer.from('e521531d67c72c20', 'hex')),

main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { WolfSSLDecryptor } from './WolfSSLDecryptor'
33
const key = Buffer.from('12345678901234567890123456789012')
44
const iv = Buffer.from('1234567890123456')
55
const decrypt = new WolfSSLDecryptor('AES-256-CBC', key, iv)
6-
const expected = 'test'
6+
const expected = 'test\0\0\0\0\0\0\0\0\0\0\0\0'
77

88
const actual = Buffer.concat([
99
decrypt.update(Buffer.from('24d31b1e41fc8c40', 'hex')),

0 commit comments

Comments
 (0)