Skip to content

Commit 078e6b0

Browse files
committed
fix: removed some null-safety operations in public_key.dart and private_key.dart which were necessary when working with previous versions of the asn1lib package but are no longer necessary since v1.5.0
1 parent 6035f69 commit 078e6b0

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/src/rsa/private_key.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class RSAPrivateKey implements PrivateKey {
2020
final topLevelSeq = asn1Parser.nextObject() as ASN1Sequence;
2121
final privateKey = topLevelSeq.elements[2];
2222

23-
asn1Parser = ASN1Parser(privateKey.contentBytes()!);
23+
asn1Parser = ASN1Parser(privateKey.contentBytes());
2424
final pkSeq = asn1Parser.nextObject() as ASN1Sequence;
2525

2626
final modulus = pkSeq.elements[1] as ASN1Integer;
@@ -29,8 +29,8 @@ class RSAPrivateKey implements PrivateKey {
2929
final q = pkSeq.elements[5] as ASN1Integer;
3030

3131
_privateKey = pointy.RSAPrivateKey(
32-
modulus.valueAsBigInteger!,
33-
privateExponent.valueAsBigInteger!,
32+
modulus.valueAsBigInteger,
33+
privateExponent.valueAsBigInteger,
3434
p.valueAsBigInteger,
3535
q.valueAsBigInteger);
3636
}

lib/src/rsa/public_key.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ class RSAPublicKey implements PublicKey {
2020
final topLevelSeq = asn1Parser.nextObject() as ASN1Sequence;
2121
final publicKeyBitString = topLevelSeq.elements[1];
2222

23-
final publicKeyAsn = ASN1Parser(publicKeyBitString.contentBytes()!);
23+
final publicKeyAsn = ASN1Parser(publicKeyBitString.contentBytes());
2424
final publicKeySeq = publicKeyAsn.nextObject() as ASN1Sequence;
2525
final modulus = publicKeySeq.elements[0] as ASN1Integer;
2626
final exponent = publicKeySeq.elements[1] as ASN1Integer;
2727

2828
_publicKey = pointy.RSAPublicKey(
29-
modulus.valueAsBigInteger!, exponent.valueAsBigInteger!);
29+
modulus.valueAsBigInteger, exponent.valueAsBigInteger);
3030
}
3131

3232
/// Create an [RSAPublicKey] from the given PEM-String.

0 commit comments

Comments
 (0)