diff --git a/lib/src/testing/utils/testrunner.dart b/lib/src/testing/utils/testrunner.dart index 0480f713..6aed509a 100644 --- a/lib/src/testing/utils/testrunner.dart +++ b/lib/src/testing/utils/testrunner.dart @@ -809,7 +809,7 @@ void _runTests( signature = c.signature; } else { test('create signature', () async { - signature = await r._signBytes!( + signature = await r._signBytes( privateKey as PrivateKey, c.plaintext!, c.signVerifyParams!, @@ -838,7 +838,7 @@ void _runTests( ciphertext = c.ciphertext!; } else { test('create ciphertext', () async { - ciphertext = await r._encryptBytes!( + ciphertext = await r._encryptBytes( publicKey as PublicKey, c.plaintext!, c.encryptDecryptParams!, @@ -866,7 +866,7 @@ void _runTests( derivedBits = c.derivedBits!; } else { test('create derivedBits', () async { - derivedBits = await r._deriveBits!( + derivedBits = await r._deriveBits( _KeyPair( privateKey: privateKey as PrivateKey, publicKey: publicKey as PublicKey), @@ -877,7 +877,7 @@ void _runTests( } test('validated derivedBits', () async { - final derived = await r._deriveBits!( + final derived = await r._deriveBits( _KeyPair( privateKey: privateKey as PrivateKey, publicKey: publicKey as PublicKey), @@ -901,7 +901,7 @@ void _runTests( 'failed to verify signature', ); check( - !await r._verifyBytes!( + !await r._verifyBytes( key, flipFirstBits(sig), c.plaintext!, @@ -911,7 +911,7 @@ void _runTests( ); if (c.plaintext!.isNotEmpty) { check( - !await r._verifyBytes!( + !await r._verifyBytes( key, sig, flipFirstBits(c.plaintext!), @@ -931,7 +931,7 @@ void _runTests( // If ciphertext is mangled some primitives like AES-GCM must throw // others may return garbled plaintext. try { - final invalidText = await r._decryptBytes!( + final invalidText = await r._decryptBytes( key, flipFirstBits(ctext), c.encryptDecryptParams!, @@ -974,7 +974,7 @@ void _runTests( await checkVerifyBytes(publicKey as PublicKey, signature); } if (r._encryptBytes != null) { - final ctext = await r._encryptBytes!( + final ctext = await r._encryptBytes( publicKey as PublicKey, c.plaintext!, c.encryptDecryptParams!, @@ -982,7 +982,7 @@ void _runTests( await checkCipherText(ctext); } if (r._deriveBits != null) { - final derived = await r._deriveBits!( + final derived = await r._deriveBits( _KeyPair( privateKey: privateKey as PrivateKey, publicKey: publicKey as PublicKey), @@ -997,7 +997,7 @@ void _runTests( Future checkPrivateKey(PrivateKey? privateKey) async { check(privateKey != null, 'privateKey is null'); if (r._signBytes != null) { - final sig = await r._signBytes!( + final sig = await r._signBytes( privateKey as PrivateKey, c.plaintext!, c.signVerifyParams!, @@ -1008,7 +1008,7 @@ void _runTests( await checkDecryptBytes(privateKey as PrivateKey, ciphertext!); } if (r._deriveBits != null) { - final derived = await r._deriveBits!( + final derived = await r._deriveBits( _KeyPair( privateKey: privateKey as PrivateKey, publicKey: publicKey as PublicKey), @@ -1093,7 +1093,7 @@ void _runTests( if (r._signBytes != null) { test('signBytes(plaintext)', () async { - final sig = await r._signBytes!( + final sig = await r._signBytes( privateKey as PrivateKey, c.plaintext!, c.signVerifyParams!, @@ -1104,7 +1104,7 @@ void _runTests( if (r._signStream != null) { test('signStream(plaintext)', () async { - final sig = await r._signStream!( + final sig = await r._signStream( privateKey as PrivateKey, Stream.value(c.plaintext!), c.signVerifyParams!, @@ -1113,7 +1113,7 @@ void _runTests( }); test('signStream(fibChunked(plaintext))', () async { - final sig = await r._signStream!( + final sig = await r._signStream( privateKey as PrivateKey, fibonacciChunkedStream(c.plaintext!), c.signVerifyParams!, @@ -1127,7 +1127,7 @@ void _runTests( if (r._verifyBytes != null) { test('verifyBytes(signature, plaintext)', () async { check( - await r._verifyBytes!( + await r._verifyBytes( publicKey as PublicKey, signature!, c.plaintext!, @@ -1137,7 +1137,7 @@ void _runTests( ); check( - !await r._verifyBytes!( + !await r._verifyBytes( publicKey as PublicKey, flipFirstBits(signature!), c.plaintext!, @@ -1148,7 +1148,7 @@ void _runTests( if (c.plaintext!.isNotEmpty) { check( - !await r._verifyBytes!( + !await r._verifyBytes( publicKey as PublicKey, signature!, flipFirstBits(c.plaintext!), @@ -1163,7 +1163,7 @@ void _runTests( if (r._verifyStream != null) { test('verifyStream(signature, Stream.value(plaintext))', () async { check( - await r._verifyStream!( + await r._verifyStream( publicKey as PublicKey, signature!, Stream.value(c.plaintext!), @@ -1173,7 +1173,7 @@ void _runTests( ); check( - !await r._verifyStream!( + !await r._verifyStream( publicKey as PublicKey, flipFirstBits(signature!), Stream.value(c.plaintext!), @@ -1184,7 +1184,7 @@ void _runTests( if (c.plaintext!.isNotEmpty) { check( - !await r._verifyStream!( + !await r._verifyStream( publicKey as PublicKey, signature!, Stream.value(flipFirstBits(c.plaintext!)), @@ -1197,7 +1197,7 @@ void _runTests( test('verifyStream(signature, fibChunkedStream(plaintext))', () async { check( - await r._verifyStream!( + await r._verifyStream( publicKey as PublicKey, signature!, fibonacciChunkedStream(c.plaintext!), @@ -1207,7 +1207,7 @@ void _runTests( ); check( - !await r._verifyStream!( + !await r._verifyStream( publicKey as PublicKey, flipFirstBits(signature!), fibonacciChunkedStream(c.plaintext!), @@ -1218,7 +1218,7 @@ void _runTests( if (c.plaintext!.isNotEmpty) { check( - !await r._verifyStream!( + !await r._verifyStream( publicKey as PublicKey, signature!, fibonacciChunkedStream(flipFirstBits(c.plaintext!)), @@ -1234,7 +1234,7 @@ void _runTests( if (r._encryptBytes != null) { test('encryptBytes(plaintext)', () async { - final ctext = await r._encryptBytes!( + final ctext = await r._encryptBytes( publicKey as PublicKey, c.plaintext!, c.encryptDecryptParams!, @@ -1245,7 +1245,7 @@ void _runTests( if (r._encryptStream != null) { test('encryptStream(plaintext)', () async { - final ctext = await bufferStream(r._encryptStream!( + final ctext = await bufferStream(r._encryptStream( publicKey as PublicKey, Stream.value(c.plaintext!), c.encryptDecryptParams!, @@ -1254,7 +1254,7 @@ void _runTests( }); test('encryptStream(fibChunked(plaintext))', () async { - final ctext = await bufferStream(r._encryptStream!( + final ctext = await bufferStream(r._encryptStream( publicKey as PublicKey, fibonacciChunkedStream(c.plaintext!), c.encryptDecryptParams!, @@ -1267,7 +1267,7 @@ void _runTests( if (r._decryptBytes != null) { test('decryptBytes(plaintext)', () async { - final text = await r._decryptBytes!( + final text = await r._decryptBytes( privateKey as PrivateKey, ciphertext!, c.encryptDecryptParams!, @@ -1281,7 +1281,7 @@ void _runTests( // If ciphertext is mangled some primitives like AES-GCM must throw // others may return garbled plaintext. try { - final text2 = await r._decryptBytes!( + final text2 = await r._decryptBytes( privateKey as PrivateKey, flipFirstBits(ciphertext!), c.encryptDecryptParams!, @@ -1299,7 +1299,7 @@ void _runTests( if (r._decryptStream != null) { test('decryptStream(Stream.value(ciphertext))', () async { - final text = await bufferStream(r._decryptStream!( + final text = await bufferStream(r._decryptStream( privateKey as PrivateKey, Stream.value(ciphertext!), c.encryptDecryptParams!, @@ -1313,7 +1313,7 @@ void _runTests( // If ciphertext is mangled some primitives like AES-GCM must throw // others may return garbled plaintext. try { - final text2 = await bufferStream(r._decryptStream!( + final text2 = await bufferStream(r._decryptStream( privateKey as PrivateKey, Stream.value(flipFirstBits(ciphertext!)), c.encryptDecryptParams!, @@ -1329,7 +1329,7 @@ void _runTests( }); test('decryptStream(fibChunkedStream(ciphertext))', () async { - final text = await bufferStream(r._decryptStream!( + final text = await bufferStream(r._decryptStream( privateKey as PrivateKey, fibonacciChunkedStream(ciphertext!), c.encryptDecryptParams!, @@ -1343,7 +1343,7 @@ void _runTests( // If ciphertext is mangled some primitives like AES-GCM must throw // others may return garbled plaintext. try { - final text2 = await bufferStream(r._decryptStream!( + final text2 = await bufferStream(r._decryptStream( privateKey as PrivateKey, fibonacciChunkedStream(flipFirstBits(ciphertext!)), c.encryptDecryptParams!, @@ -1362,7 +1362,7 @@ void _runTests( //------------------------------ Test derivedBits if (r._deriveBits != null) { test('deriveBits', () async { - final derived = await r._deriveBits!( + final derived = await r._deriveBits( _KeyPair( privateKey: privateKey as PrivateKey, publicKey: publicKey as PublicKey), @@ -1376,7 +1376,7 @@ void _runTests( //------------------------------ export/import private key if (r._exportPrivateRawKey != null) { test('export/import raw private key', () async { - final keyData = await r._exportPrivateRawKey!(privateKey as PrivateKey); + final keyData = await r._exportPrivateRawKey(privateKey as PrivateKey); check(keyData.isNotEmpty, 'exported key is empty'); final key = await r._importPrivateRawKey!(keyData, c.importKeyParams!); @@ -1386,7 +1386,7 @@ void _runTests( if (r._exportPrivatePkcs8Key != null) { test('export/import pkcs8 private key', () async { - final keyData = await r._exportPrivatePkcs8Key!(privateKey as PrivateKey); + final keyData = await r._exportPrivatePkcs8Key(privateKey as PrivateKey); check(keyData.isNotEmpty, 'exported key is empty'); final key = await r._importPrivatePkcs8Key!(keyData, c.importKeyParams!); @@ -1396,7 +1396,7 @@ void _runTests( if (r._exportPrivateJsonWebKey != null) { test('export/import jwk private key', () async { - final jwk = await r._exportPrivateJsonWebKey!(privateKey as PrivateKey); + final jwk = await r._exportPrivateJsonWebKey(privateKey as PrivateKey); check(jwk.isNotEmpty, 'exported key is empty'); final key = await r._importPrivateJsonWebKey!(jwk, c.importKeyParams!); @@ -1410,7 +1410,7 @@ void _runTests( assert(!r._isSymmetric && r._importPublicRawKey != null); test('export/import raw public key', () async { - final keyData = await r._exportPublicRawKey!(publicKey as PublicKey); + final keyData = await r._exportPublicRawKey(publicKey as PublicKey); check(keyData.isNotEmpty, 'exported key is empty'); final key = await r._importPublicRawKey!(keyData, c.importKeyParams!); @@ -1422,7 +1422,7 @@ void _runTests( assert(!r._isSymmetric && r._importPublicSpkiKey != null); test('export/import pkcs8 public key', () async { - final keyData = await r._exportPublicSpkiKey!(publicKey as PublicKey); + final keyData = await r._exportPublicSpkiKey(publicKey as PublicKey); check(keyData.isNotEmpty, 'exported key is empty'); final key = await r._importPublicSpkiKey!(keyData, c.importKeyParams!); @@ -1434,7 +1434,7 @@ void _runTests( assert(!r._isSymmetric && r._importPublicJsonWebKey != null); test('export/import jwk public key', () async { - final jwk = await r._exportPublicJsonWebKey!(publicKey as PublicKey); + final jwk = await r._exportPublicJsonWebKey(publicKey as PublicKey); check(jwk.isNotEmpty, 'exported key is empty'); final key = await r._importPublicJsonWebKey!(jwk, c.importKeyParams!);