File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
Yubico.YubiKey/src/Yubico/YubiKey/Cryptography Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -16,20 +16,20 @@ namespace Yubico.YubiKey.Cryptography;
16
16
17
17
public static class KeyTypeExtensions
18
18
{
19
- public static string ToAlgorithmOid ( this KeyType keyType ) => Oids . GetOidsByKeyType ( keyType ) . AlgorithmOid ;
20
- public static string ? ToCurveOid ( this KeyType keyType ) => Oids . GetOidsByKeyType ( keyType ) . Curveoid ;
21
19
public static KeyDefinition GetKeyDefinition ( this KeyType keyType ) => KeyDefinitions . GetByKeyType ( keyType ) ;
20
+ public static string GetAlgorithmOid ( this KeyType keyType ) => Oids . GetOidsByKeyType ( keyType ) . AlgorithmOid ;
21
+ public static string ? GetCurveOid ( this KeyType keyType ) => Oids . GetOidsByKeyType ( keyType ) . Curveoid ;
22
+ public static int GetKeySizeBits ( this KeyType keyType ) => keyType . GetKeyDefinition ( ) . LengthInBits ;
23
+ public static int GetKeySizeBytes ( this KeyType keyType ) => keyType . GetKeyDefinition ( ) . LengthInBytes ;
22
24
public static bool IsCoseKey ( this KeyType keyType ) => keyType . GetKeyDefinition ( ) . CoseKeyDefinition != null ;
23
25
public static bool IsECDsa ( this KeyType keyType ) => keyType is KeyType . ECP256 or KeyType . ECP384 or KeyType . ECP521 ;
24
26
public static bool IsCurve25519 ( this KeyType keyType ) => keyType is KeyType . X25519 or KeyType . Ed25519 ;
25
27
public static bool IsAsymmetric ( this KeyType keyType ) =>
26
28
IsEllipticCurve ( keyType ) || IsRSA ( keyType ) ;
27
29
public static bool IsSymmetric ( this KeyType keyType ) =>
28
30
keyType is KeyType . TripleDES or KeyType . AES128 or KeyType . AES192 or KeyType . AES256 ;
29
-
30
31
public static bool IsEllipticCurve ( this KeyType keyType ) =>
31
32
keyType is KeyType . ECP256 or KeyType . ECP384 or KeyType . ECP521 or KeyType . X25519 or KeyType . Ed25519 ;
32
-
33
33
public static bool IsRSA ( this KeyType keyType ) =>
34
34
keyType is KeyType . RSA1024 or KeyType . RSA2048 or KeyType . RSA3072 or KeyType . RSA4096 ;
35
35
}
You can’t perform that action at this time.
0 commit comments