Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e6dda65

Browse files
committed
Allow empty HMAC key
1 parent 604fb48 commit e6dda65

File tree

2 files changed

+0
-14
lines changed

2 files changed

+0
-14
lines changed

cryptography/lib/src/browser/hmac.dart

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,6 @@ class BrowserHmac extends Hmac {
6666

6767
Future<web_crypto.CryptoKey> _jsCryptoKey(SecretKey secretKey) async {
6868
final secretKeyBytes = await secretKey.extractBytes();
69-
if (secretKeyBytes.isEmpty) {
70-
throw ArgumentError.value(
71-
secretKey,
72-
'secretKey',
73-
'SecretKey bytes must be non-empty',
74-
);
75-
}
7669
return await web_crypto.importKeyWhenRaw(
7770
web_crypto.jsUint8ListFrom(secretKeyBytes),
7871
web_crypto.HmacImportParams(

cryptography/lib/src/dart/hmac.dart

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,6 @@ class _DartHmacSink extends MacSink with DartMacSinkMixin {
120120
'AAD is not supported by HMAC',
121121
);
122122
}
123-
if (secretKey.bytes.isEmpty) {
124-
throw ArgumentError.value(
125-
secretKey,
126-
'secretKey',
127-
'Secret key must be non-empty',
128-
);
129-
}
130123
_isClosed = false;
131124
var hmacKey = secretKey.bytes;
132125
var eraseKey = false;

0 commit comments

Comments
 (0)