Skip to content

Commit

Permalink
Add missing KeyBuilder transient types
Browse files Browse the repository at this point in the history
Partially addresses licel#211.
  • Loading branch information
simonratner authored Feb 29, 2024
1 parent b54b18b commit 4aedea6
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/main/java/com/licel/jcardsim/crypto/KeyBuilderProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,14 @@ public static Key buildKey(byte keyType, short keyLength, boolean keyEncryption)
key = new RSAKeyImpl(false, keyLength);
break;

case KeyBuilder.TYPE_RSA_PRIVATE_TRANSIENT_RESET:
case KeyBuilder.TYPE_RSA_PRIVATE_TRANSIENT_DESELECT:
case KeyBuilder.TYPE_RSA_PRIVATE:
key = new RSAKeyImpl(true, keyLength);
break;

case KeyBuilder.TYPE_RSA_CRT_PRIVATE_TRANSIENT_RESET:
case KeyBuilder.TYPE_RSA_CRT_PRIVATE_TRANSIENT_DESELECT:
case KeyBuilder.TYPE_RSA_CRT_PRIVATE:
key = new RSAPrivateCrtKeyImpl(keyLength);
break;
Expand All @@ -76,6 +80,8 @@ public static Key buildKey(byte keyType, short keyLength, boolean keyEncryption)
key = new DSAPublicKeyImpl(keyLength);
break;

case KeyBuilder.TYPE_DSA_PRIVATE_TRANSIENT_RESET:
case KeyBuilder.TYPE_DSA_PRIVATE_TRANSIENT_DESELECT:
case KeyBuilder.TYPE_DSA_PRIVATE:
key = new DSAPrivateKeyImpl(keyLength);
break;
Expand All @@ -84,13 +90,19 @@ public static Key buildKey(byte keyType, short keyLength, boolean keyEncryption)
case KeyBuilder.TYPE_EC_F2M_PUBLIC:
key = new ECPublicKeyImpl(keyType, keyLength);
break;

case KeyBuilder.TYPE_EC_F2M_PRIVATE_TRANSIENT_RESET:
case KeyBuilder.TYPE_EC_F2M_PRIVATE_TRANSIENT_DESELECT:
case KeyBuilder.TYPE_EC_F2M_PRIVATE:
key = new ECPrivateKeyImpl(keyType, keyLength);
break;

case KeyBuilder.TYPE_EC_FP_PUBLIC:
key = new ECPublicKeyImpl(keyType, keyLength);
break;

case KeyBuilder.TYPE_EC_FP_PRIVATE_TRANSIENT_RESET:
case KeyBuilder.TYPE_EC_FP_PRIVATE_TRANSIENT_DESELECT:
case KeyBuilder.TYPE_EC_FP_PRIVATE:
key = new ECPrivateKeyImpl(keyType, keyLength);
break;
Expand Down

0 comments on commit 4aedea6

Please sign in to comment.