-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WebCrypto: Add test cases for deriveBits with too large and non-multiple of 8 lengths #48471
WebCrypto: Add test cases for deriveBits with too large and non-multiple of 8 lengths #48471
Conversation
a35dc6d
to
06b245b
Compare
@@ -9,25 +9,33 @@ var algorithms = { | |||
privateKey: {format: "raw", data: rawKey}, | |||
deriveAlg: {name: "HKDF", salt: salt, hash: "SHA-256", info: info}, | |||
derivation: new Uint8Array([49, 183, 214, 133, 48, 168, 99, 231, 23, 192, 129, 202, 105, 23, 182, 134, 80, 179, 221, 154, 41, 243, 6, 6, 226, 202, 209, 153, 190, 193, 77, 19]), | |||
derivation384: new Uint8Array([49, 183, 214, 133, 48, 168, 99, 231, 23, 192, 129, 202, 105, 23, 182, 134, 80, 179, 221, 154, 41, 243, 6, 6, 226, 202, 209, 153, 190, 193, 77, 19, 165, 50, 181, 8, 254, 59, 122, 199, 25, 224,146, 248, 105, 105, 75, 84]), | |||
derivation230: new Uint8Array([]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bit nitpicky but perhaps we should make this one undefined
as well (and same for the others)? Otherwise it may look a bit confusing here, like we're expecting an empty Uint8Array for 230 bits or so.
derivation230: new Uint8Array([]), | |
derivation230: undefined, |
(or we could just remove it altogether?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good suggestion, thanks.
{length: 384, expected: undefined}, // should throw an exception, bigger than the key size | ||
{length: 230, expected: algorithms["ECDH"].derivation230}, | ||
{length: 0, expected: emptyArray}, | ||
{length: null, expected: algorithms["ECDH"].derivation}, | ||
{length: undefined, expected: algorithms["ECDH"].derivation}, | ||
{length: "omitted", expected: algorithms["ECDH"].derivation }, // default value is null | ||
], | ||
"X25519": [ | ||
{length: 256, expected: algorithms["X25519"].derivation}, | ||
{length: 384, expected: undefined}, // should throw an exception, bigger than the key size | ||
{length: 230, expected: algorithms["X25519"].derivation230}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{length: 384, expected: undefined}, // should throw an exception, bigger than the key size | |
{length: 230, expected: algorithms["ECDH"].derivation230}, | |
{length: 0, expected: emptyArray}, | |
{length: null, expected: algorithms["ECDH"].derivation}, | |
{length: undefined, expected: algorithms["ECDH"].derivation}, | |
{length: "omitted", expected: algorithms["ECDH"].derivation }, // default value is null | |
], | |
"X25519": [ | |
{length: 256, expected: algorithms["X25519"].derivation}, | |
{length: 384, expected: undefined}, // should throw an exception, bigger than the key size | |
{length: 230, expected: algorithms["X25519"].derivation230}, | |
{length: 384, expected: undefined}, // should throw an exception, bigger than the output size | |
{length: 230, expected: algorithms["ECDH"].derivation230}, | |
{length: 0, expected: emptyArray}, | |
{length: null, expected: algorithms["ECDH"].derivation}, | |
{length: undefined, expected: algorithms["ECDH"].derivation}, | |
{length: "omitted", expected: algorithms["ECDH"].derivation }, // default value is null | |
], | |
"X25519": [ | |
{length: 256, expected: algorithms["X25519"].derivation}, | |
{length: 384, expected: undefined}, // should throw an exception, bigger than the output size | |
{length: 230, expected: algorithms["X25519"].derivation230}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
06b245b
to
738c993
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Thanks!
No description provided.