File tree Expand file tree Collapse file tree 6 files changed +13
-13
lines changed
integration/Yubico/YubiKey/Piv
unit/Yubico/YubiKey/Cryptography
utilities/Yubico/YubiKey/TestUtilities Expand file tree Collapse file tree 6 files changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ public void KeyAgree_SharedSecret_IsValid(
47
47
if ( keyType is KeyType . X25519 )
48
48
{
49
49
var testSelectedPublicKeyPeer = TestKeys . GetTestPublicKey ( keyType , 2 ) ;
50
- peerPublicKey = Curve25519PublicKey . CreateFromPkcs8 ( testSelectedPublicKeyPeer . EncodedKey ) ;
50
+ peerPublicKey = Curve25519PublicKey . CreateFromSubjectPublicKeyInfo ( testSelectedPublicKeyPeer . EncodedKey ) ;
51
51
}
52
52
else
53
53
{
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ public void CreateCurve25519FromPkcs8EncodedKey_WithValidKey_CreatesInstance(Key
46
46
var testPublicKey = TestKeys . GetTestPublicKey ( keyType ) ;
47
47
48
48
// Act
49
- var publicKey = Curve25519PublicKey . CreateFromPkcs8 ( testPublicKey . EncodedKey ) ;
49
+ var publicKey = Curve25519PublicKey . CreateFromSubjectPublicKeyInfo ( testPublicKey . EncodedKey ) ;
50
50
Assert . NotNull ( publicKey ) ;
51
51
52
52
// Assert
@@ -63,7 +63,7 @@ public void CreateFromPkcs8_CreatesInstance(KeyType keyType)
63
63
var testPublicPoint = testKey . GetPublicPoint ( ) ;
64
64
65
65
// Act
66
- var publicKey = Curve25519PublicKey . CreateFromPkcs8 ( testKey . EncodedKey ) ;
66
+ var publicKey = Curve25519PublicKey . CreateFromSubjectPublicKeyInfo ( testKey . EncodedKey ) ;
67
67
68
68
// Assert
69
69
Assert . NotNull ( publicKey ) ;
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ public void CreateECDsaFromPkcs8EncodedKey_WithValidKey_CreatesInstance(KeyType
43
43
44
44
// Act
45
45
var publicKey = ecdsa . ExportSubjectPublicKeyInfo ( ) ;
46
- var publicKeyParams = ECPublicKey . CreateFromPkcs8 ( publicKey ) ;
46
+ var publicKeyParams = ECPublicKey . CreateFromSubjectPublicKeyInfo ( publicKey ) ;
47
47
var ecPublicKeyParams = publicKeyParams as ECPublicKey ;
48
48
Assert . NotNull ( ecPublicKeyParams ) ;
49
49
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ public void CreateFromPkcs8_WithValidParameters_CreatesInstance()
35
35
var publicKeyPkcs = rsa . ExportSubjectPublicKeyInfo ( ) ;
36
36
37
37
// Act
38
- var publicKey = RSAPublicKey . CreateFromPkcs8 ( publicKeyPkcs ) ;
38
+ var publicKey = RSAPublicKey . CreateFromSubjectPublicKeyInfo ( publicKeyPkcs ) ;
39
39
40
40
// Assert
41
41
Assert . Null ( publicKey . Parameters . D ) ;
Original file line number Diff line number Diff line change @@ -80,8 +80,8 @@ public byte[] GetPublicPoint()
80
80
}
81
81
82
82
return KeyDefinition is { IsEllipticCurve : true , AlgorithmOid : Oids . ECDSA }
83
- ? ECPublicKey . CreateFromPkcs8 ( EncodedKey ) . PublicPoint . ToArray ( )
84
- : Curve25519PublicKey . CreateFromPkcs8 ( EncodedKey ) . PublicPoint . ToArray ( ) ;
83
+ ? ECPublicKey . CreateFromSubjectPublicKeyInfo ( EncodedKey ) . PublicPoint . ToArray ( )
84
+ : Curve25519PublicKey . CreateFromSubjectPublicKeyInfo ( EncodedKey ) . PublicPoint . ToArray ( ) ;
85
85
}
86
86
87
87
public IPublicKey AsPublicKey ( )
@@ -93,15 +93,15 @@ public IPublicKey AsPublicKey()
93
93
94
94
if ( KeyDefinition . IsRSA )
95
95
{
96
- return RSAPublicKey . CreateFromPkcs8 ( EncodedKey ) ;
96
+ return RSAPublicKey . CreateFromSubjectPublicKeyInfo ( EncodedKey ) ;
97
97
}
98
98
99
99
if ( KeyDefinition is { IsEllipticCurve : true , AlgorithmOid : Oids . ECDSA } )
100
100
{
101
- return ECPublicKey . CreateFromPkcs8 ( EncodedKey ) ;
101
+ return ECPublicKey . CreateFromSubjectPublicKeyInfo ( EncodedKey ) ;
102
102
}
103
103
104
- return Curve25519PublicKey . CreateFromPkcs8 ( EncodedKey ) ;
104
+ return Curve25519PublicKey . CreateFromSubjectPublicKeyInfo ( EncodedKey ) ;
105
105
}
106
106
107
107
public byte [ ] GetPrivateKeyValue ( )
Original file line number Diff line number Diff line change @@ -50,19 +50,19 @@ public static PivPublicKey AsPivPublicKey(
50
50
var keyDefinition = key . KeyDefinition ;
51
51
if ( keyDefinition . IsRSA )
52
52
{
53
- var rsaPublicKey = RSAPublicKey . CreateFromPkcs8 ( key . EncodedKey ) ;
53
+ var rsaPublicKey = RSAPublicKey . CreateFromSubjectPublicKeyInfo ( key . EncodedKey ) ;
54
54
var rsaPivEncodedKey = rsaPublicKey . EncodeAsPiv ( ) ;
55
55
return PivPublicKey . Create ( rsaPivEncodedKey , key . KeyType . GetPivAlgorithm ( ) ) ;
56
56
}
57
57
58
58
if ( keyDefinition is { IsEllipticCurve : true , AlgorithmOid : Oids . ECDSA } )
59
59
{
60
- var ecPublicKey = ECPublicKey . CreateFromPkcs8 ( key . EncodedKey ) ;
60
+ var ecPublicKey = ECPublicKey . CreateFromSubjectPublicKeyInfo ( key . EncodedKey ) ;
61
61
var ecPivEncodedKey = ecPublicKey . EncodeAsPiv ( ) ;
62
62
return PivPublicKey . Create ( ecPivEncodedKey , key . KeyType . GetPivAlgorithm ( ) ) ;
63
63
}
64
64
65
- var cvPublicKey = Curve25519PublicKey . CreateFromPkcs8 ( key . EncodedKey ) ;
65
+ var cvPublicKey = Curve25519PublicKey . CreateFromSubjectPublicKeyInfo ( key . EncodedKey ) ;
66
66
var cvPivEncodedKey = cvPublicKey . EncodeAsPiv ( ) ;
67
67
return PivPublicKey . Create ( cvPivEncodedKey , keyDefinition . KeyType . GetPivAlgorithm ( ) ) ;
68
68
}
You can’t perform that action at this time.
0 commit comments