Class KeyBuilder
- java.lang.Object
-
- javacard.security.KeyBuilder
-
public class KeyBuilder extends Object
TheKeyBuilderclass is a key object factory.
-
-
Field Summary
Fields Modifier and Type Field Description static byteALG_TYPE_AESAlgorithmic key typeALG_TYPE_AESchoice for thealgorithmicKeyTypeparameter of thebuildKey(byte, byte, short, boolean)method.static byteALG_TYPE_DESAlgorithmic key typeALG_TYPE_DESchoice for thealgorithmicKeyTypeparameter of thebuildKey(byte, byte, short, boolean)method.static byteALG_TYPE_DH_PARAMETERSAlgorithmic key typeALG_TYPE_DH_PARAMETERSchoice for thealgorithmicKeyTypeparameter of thebuildKey(byte, byte, short, boolean)method.static byteALG_TYPE_DH_PRIVATEAlgorithmic key typeALG_TYPE_DH_PRIVATEchoice for thealgorithmicKeyTypeparameter of thebuildKey(byte, byte, short, boolean)method.static byteALG_TYPE_DH_PUBLICAlgorithmic key typeALG_TYPE_DH_PUBLICchoice for thealgorithmicKeyTypeparameter of thebuildKey(byte, byte, short, boolean)method.static byteALG_TYPE_DSA_PARAMETERSAlgorithmic key typeALG_TYPE_DSA_PARAMETERSchoice for thealgorithmicKeyTypeparameter of thebuildKey(byte, byte, short, boolean)method.static byteALG_TYPE_DSA_PRIVATEAlgorithmic key typeALG_TYPE_DSA_PRIVATEchoice for thealgorithmicKeyTypeparameter of thebuildKey(byte, byte, short, boolean)method.static byteALG_TYPE_DSA_PUBLICAlgorithmic key typeALG_TYPE_DSA_PUBLICchoice for thealgorithmicKeyTypeparameter of thebuildKey(byte, byte, short, boolean)method.static byteALG_TYPE_EC_F2M_PARAMETERSAlgorithmic key typeALG_TYPE_EC_F2M_PARAMETERSchoice for thealgorithmicKeyTypeparameter of thebuildKey(byte, byte, short, boolean)method.static byteALG_TYPE_EC_F2M_PRIVATEAlgorithmic key typeALG_TYPE_EC_F2M_PRIVATEchoice for thealgorithmicKeyTypeparameter of thebuildKey(byte, byte, short, boolean)method.static byteALG_TYPE_EC_F2M_PUBLICAlgorithmic key typeALG_TYPE_EC_F2M_PUBLICchoice for thealgorithmicKeyTypeparameter of thebuildKey(byte, byte, short, boolean)method.static byteALG_TYPE_EC_FP_PARAMETERSAlgorithmic key typeALG_TYPE_EC_FP_PARAMETERSchoice for thealgorithmicKeyTypeparameter of thebuildKey(byte, byte, short, boolean)method.static byteALG_TYPE_EC_FP_PRIVATEAlgorithmic key typeALG_TYPE_EC_FP_PRIVATEchoice for thealgorithmicKeyTypeparameter of thebuildKey(byte, byte, short, boolean)method.static byteALG_TYPE_EC_FP_PUBLICAlgorithmic key typeALG_TYPE_EC_FP_PUBLICchoice for thealgorithmicKeyTypeparameter of thebuildKey(byte, byte, short, boolean)method.static byteALG_TYPE_GENERIC_SECRETAlgorithmic key typeALG_GENERIC_SECRETchoice for thealgorithmicKeyTypeparameter of thebuildKey(byte, byte, short, boolean)method.static byteALG_TYPE_HMACAlgorithmic key typeALG_TYPE_HMACchoice for thealgorithmicKeyTypeparameter of thebuildKey(byte, byte, short, boolean)method.static byteALG_TYPE_KOREAN_SEEDAlgorithmic key typeALG_TYPE_KOREAN_SEEDchoice for thealgorithmicKeyTypeparameter of thebuildKey(byte, byte, short, boolean)method.static byteALG_TYPE_RSA_CRT_PRIVATEAlgorithmic key typeALG_TYPE_RSA_CRT_PRIVATEchoice for thealgorithmicKeyTypeparameter of thebuildKey(byte, byte, short, boolean)method.static byteALG_TYPE_RSA_PRIVATEAlgorithmic key typeALG_TYPE_RSA_PRIVATEchoice for thealgorithmicKeyTypeparameter of thebuildKey(byte, byte, short, boolean)method.static byteALG_TYPE_RSA_PUBLICAlgorithmic key typeALG_TYPE_RSA_PUBLICchoice for thealgorithmicKeyTypeparameter of thebuildKey(byte, byte, short, boolean)method.static byteALG_TYPE_SM4Algorithmic key typeALG_SM4choice for thealgorithmicKeyTypeparameter of thebuildKey(byte, byte, short, boolean)method.static shortATTR_PRIVATEKey attribute used to create a newXECPrivateKeyinstance.static shortATTR_PUBLICKey attribute used to create a newXECPublicKeyinstance.static shortLENGTH_AES_128AES Key LengthLENGTH_AES_128= 128.static shortLENGTH_AES_192AES Key LengthLENGTH_AES_192= 192.static shortLENGTH_AES_256AES Key LengthLENGTH_AES_256= 256.static shortLENGTH_AES_512AES Key LengthLENGTH_AES_512= 512.static shortLENGTH_DESDES Key LengthLENGTH_DES= 64.static shortLENGTH_DES3_2KEYDES Key LengthLENGTH_DES3_2KEYfor triple DES algorithm = 128.static shortLENGTH_DES3_3KEYDES Key LengthLENGTH_DES3_3KEYfor triple DES algorithm = 192.static shortLENGTH_DH_1024DH Key LengthLENGTH_DH_1024= 1024.static shortLENGTH_DH_2048DH Key LengthLENGTH_DH_2048= 2048.static shortLENGTH_DSA_1024DSA Key LengthLENGTH_DSA_1024= 1024.static shortLENGTH_DSA_512DSA Key LengthLENGTH_DSA_512= 512.static shortLENGTH_DSA_768DSA Key LengthLENGTH_DSA_768= 768.static shortLENGTH_EC_F2M_113EC Key LengthLENGTH_EC_F2M_113= 113.static shortLENGTH_EC_F2M_131EC Key LengthLENGTH_EC_F2M_131= 131.static shortLENGTH_EC_F2M_163EC Key LengthLENGTH_EC_F2M_163= 163.static shortLENGTH_EC_F2M_193EC Key LengthLENGTH_EC_F2M_193= 193.static shortLENGTH_EC_FP_112EC Key LengthLENGTH_EC_FP_112= 112.static shortLENGTH_EC_FP_128EC Key LengthLENGTH_EC_FP_128= 128.static shortLENGTH_EC_FP_160EC Key LengthLENGTH_EC_FP_160= 160.static shortLENGTH_EC_FP_192EC Key LengthLENGTH_EC_FP_192= 192.static shortLENGTH_EC_FP_224EC Key LengthLENGTH_EC_FP_224= 224.static shortLENGTH_EC_FP_256EC Key LengthLENGTH_EC_FP_256= 256.static shortLENGTH_EC_FP_384EC Key LengthLENGTH_EC_FP_384= 384.static shortLENGTH_EC_FP_521EC Key LengthLENGTH_EC_FP_521= 521.static shortLENGTH_HMAC_SHA_1_BLOCK_64HMAC-SHA-1 block lengthLENGTH_HMAC_SHA_1_BLOCK_64= 64 expressed in bytes.static shortLENGTH_HMAC_SHA_256_BLOCK_64HMAC-SHA-256 block lengthLENGTH_HMAC_SHA_256_BLOCK_64= 64 expressed in bytes.static shortLENGTH_HMAC_SHA_384_BLOCK_128HMAC-SHA-384 block lengthLENGTH_HMAC_SHA_384_BLOCK_128= 128 expressed in bytes.static shortLENGTH_HMAC_SHA_512_BLOCK_128HMAC-SHA-512 block lengthLENGTH_HMAC_SHA_512_BLOCK_128= 128 expressed in bytes.static shortLENGTH_KOREAN_SEED_128Korean Seed Key LengthLENGTH_KOREAN_SEED_128= 128.static shortLENGTH_RSA_1024RSA Key LengthLENGTH_RSA_1024= 1024.static shortLENGTH_RSA_1280RSA Key LengthLENGTH_RSA_1280= 1280.static shortLENGTH_RSA_1536RSA Key LengthLENGTH_RSA_1536= 1536.static shortLENGTH_RSA_1984RSA Key LengthLENGTH_RSA_1984= 1984.static shortLENGTH_RSA_2048RSA Key LengthLENGTH_RSA_2048= 2048.static shortLENGTH_RSA_3072RSA Key LengthLENGTH_RSA_3072= 3072.static shortLENGTH_RSA_4096RSA Key LengthLENGTH_RSA_4096= 4096.static shortLENGTH_RSA_512RSA Key LengthLENGTH_RSA_512= 512.static shortLENGTH_RSA_736RSA Key LengthLENGTH_RSA_736= 736.static shortLENGTH_RSA_768RSA Key LengthLENGTH_RSA_768= 768.static shortLENGTH_RSA_896RSA Key LengthLENGTH_RSA_896= 896.static shortLENGTH_SM4SM4 Key LengthLENGTH_SM4= 128.static byteTYPE_AESKeyobject which implements interface typeAESKeywith persistent key data.static byteTYPE_AES_TRANSIENT_DESELECTKeyobject which implements interface typeAESKeywith CLEAR_ON_DESELECT transient key data.static byteTYPE_AES_TRANSIENT_RESETKeyobject which implements interface typeAESKeywith CLEAR_ON_RESET transient key data.static byteTYPE_DESKeyobject which implements interface typeDESKeywith persistent key data.static byteTYPE_DES_TRANSIENT_DESELECTKeyobject which implements interface typeDESKeywith CLEAR_ON_DESELECT transient key data.static byteTYPE_DES_TRANSIENT_RESETKeyobject which implements interface typeDESKeywith CLEAR_ON_RESET transient key data.static byteTYPE_DH_PARAMETERSKeyobject used to provide domain parameter inbuildKeyWithSharedDomain(byte, byte, Key, boolean).static byteTYPE_DH_PRIVATEKey object which implements the interface typeDHPrivateKeyfor DH operations.static byteTYPE_DH_PRIVATE_TRANSIENT_DESELECTKey object which implements the interface typeDHPrivateKeyfor DH operations, .static byteTYPE_DH_PRIVATE_TRANSIENT_RESETKey object which implements the interface typeDHPrivateKeyfor DH operations.static byteTYPE_DH_PUBLICKey object which implements the interface typeDHPublicKeyfor DH operations.static byteTYPE_DH_PUBLIC_TRANSIENT_DESELECTKey object which implements the interface typeDHPublicKeyfor DH operations, .static byteTYPE_DH_PUBLIC_TRANSIENT_RESETKey object which implements the interface typeDHPublicKeyfor DH operations.static byteTYPE_DSA_PARAMETERSKeyobject used to provide domain parameter inbuildKeyWithSharedDomain(byte, byte, Key, boolean).static byteTYPE_DSA_PRIVATEKeyobject which implements the interface typeDSAPrivateKeyfor the DSA algorithm.static byteTYPE_DSA_PRIVATE_TRANSIENT_DESELECTKeyobject which implements the interface typeDSAPrivateKeyfor the DSA algorithm, with CLEAR_ON_DESELECT transient key data.static byteTYPE_DSA_PRIVATE_TRANSIENT_RESETKeyobject which implements the interface typeDSAPrivateKeyfor the DSA algorithm, with CLEAR_ON_RESET transient key data.static byteTYPE_DSA_PUBLICKeyobject which implements the interface typeDSAPublicKeyfor the DSA algorithm.static byteTYPE_EC_F2M_PARAMETERSKeyobject used to provide domain parameter inbuildKeyWithSharedDomain(byte, byte, Key, boolean).static byteTYPE_EC_F2M_PRIVATEKey object which implements the interface typeECPrivateKeyfor EC operations over fields of characteristic 2 with polynomial basis.static byteTYPE_EC_F2M_PRIVATE_TRANSIENT_DESELECTKey object which implements the interface typeECPrivateKeyfor EC operations over fields of characteristic 2 with polynomial basis, with CLEAR_ON_DESELECT transient key data.static byteTYPE_EC_F2M_PRIVATE_TRANSIENT_RESETKey object which implements the interface typeECPrivateKeyfor EC operations over fields of characteristic 2 with polynomial basis, with CLEAR_ON_RESET transient key data.static byteTYPE_EC_F2M_PUBLICKey object which implements the interface typeECPublicKeyfor EC operations over fields of characteristic 2 with polynomial basis.static byteTYPE_EC_FP_PARAMETERSKeyobject used to provide domain parameter inbuildKeyWithSharedDomain(byte, byte, Key, boolean).static byteTYPE_EC_FP_PRIVATEKey object which implements the interface typeECPrivateKeyfor EC operations over large prime fields.static byteTYPE_EC_FP_PRIVATE_TRANSIENT_DESELECTKey object which implements the interface typeECPrivateKeyfor EC operations over large prime fields, with CLEAR_ON_DESELECT transient key data.static byteTYPE_EC_FP_PRIVATE_TRANSIENT_RESETKey object which implements the interface typeECPrivateKeyfor EC operations over large prime fields, with CLEAR_ON_RESET transient key data.static byteTYPE_EC_FP_PUBLICKey object which implements the interface typeECPublicKeyfor EC operations over large prime fields.static byteTYPE_GENERIC_SECRETKeyobject which implements interface typeGenericSecretKey.static byteTYPE_HMACKeyobject which implements interface typeHMACKeywith persistent key data.static byteTYPE_HMAC_TRANSIENT_DESELECTKeyobject which implements interface typeHMACKeywith CLEAR_ON_DESELECT transient key data.static byteTYPE_HMAC_TRANSIENT_RESETKeyobject which implements interface typeHMACKeywith CLEAR_ON_RESET transient key data.static byteTYPE_KOREAN_SEEDKeyobject which implements interface typeKoreanSEEDKeywith persistent key data.static byteTYPE_KOREAN_SEED_TRANSIENT_DESELECTKeyobject which implements interface typeKoreanSEEDKeywith CLEAR_ON_DESELECT transient key data.static byteTYPE_KOREAN_SEED_TRANSIENT_RESETKeyobject which implements interface typeKoreanSEEDKeywith CLEAR_ON_RESET transient key data.static byteTYPE_RSA_CRT_PRIVATEKeyobject which implements interface typeRSAPrivateCrtKeywhich uses Chinese Remainder Theorem.static byteTYPE_RSA_CRT_PRIVATE_TRANSIENT_DESELECTKeyobject which implements interface typeRSAPrivateCrtKeywhich uses Chinese Remainder Theorem, with CLEAR_ON_DESELECT transient key data.static byteTYPE_RSA_CRT_PRIVATE_TRANSIENT_RESETKeyobject which implements interface typeRSAPrivateCrtKeywhich uses Chinese Remainder Theorem, with CLEAR_ON_RESET transient key data.static byteTYPE_RSA_PRIVATEKeyobject which implements interface typeRSAPrivateKeywhich uses modulus/exponent form.static byteTYPE_RSA_PRIVATE_TRANSIENT_DESELECTKeyobject which implements interface typeRSAPrivateKeywhich uses modulus/exponent form, with CLEAR_ON_DESELECT transient key data.static byteTYPE_RSA_PRIVATE_TRANSIENT_RESETKeyobject which implements interface typeRSAPrivateKeywhich uses modulus/exponent form, with CLEAR_ON_RESET transient key data.static byteTYPE_RSA_PUBLICKeyobject which implements interface typeRSAPublicKey.static byteTYPE_SM4Keyobject which implements interface typeSM4Key.static byteTYPE_XECExtendedKeyobject which implements the interface typeXECKey.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static KeybuildKey(byte algorithmicKeyType, byte keyMemoryType, short keyLength, boolean keyEncryption)Creates uninitialized cryptographic keys for signature and cipher algorithms.static KeybuildKey(byte keyType, short keyLength, boolean keyEncryption)Creates uninitialized cryptographic keys for signature and cipher algorithms.static KeybuildKeyWithSharedDomain(byte algorithmicKeyType, byte keyMemoryType, Key domainParameters, boolean keyEncryption)Creates cryptographic keys for signature and key agreement algorithms.static KeybuildXECKey(NamedParameterSpec params, short attributes, boolean keyEncryption)Creates uninitialized cryptographic keys for named curves with predefined elliptic curve domain parameters.static bytegetMemoryType(Key key)Get the memory type of the specified key.
-
-
-
Field Detail
-
TYPE_DES_TRANSIENT_RESET
public static final byte TYPE_DES_TRANSIENT_RESET
Keyobject which implements interface typeDESKeywith CLEAR_ON_RESET transient key data.This
Keyobject implicitly performs aclearKey()on power on or card reset.- See Also:
- Constant Field Values
-
TYPE_DES_TRANSIENT_DESELECT
public static final byte TYPE_DES_TRANSIENT_DESELECT
Keyobject which implements interface typeDESKeywith CLEAR_ON_DESELECT transient key data.This
Keyobject implicitly performs aclearKey()on power on, card reset and applet deselection.- See Also:
- Constant Field Values
-
TYPE_DES
public static final byte TYPE_DES
Keyobject which implements interface typeDESKeywith persistent key data.- See Also:
- Constant Field Values
-
TYPE_RSA_PUBLIC
public static final byte TYPE_RSA_PUBLIC
Keyobject which implements interface typeRSAPublicKey.- See Also:
- Constant Field Values
-
TYPE_RSA_PRIVATE
public static final byte TYPE_RSA_PRIVATE
Keyobject which implements interface typeRSAPrivateKeywhich uses modulus/exponent form.- See Also:
- Constant Field Values
-
TYPE_RSA_CRT_PRIVATE
public static final byte TYPE_RSA_CRT_PRIVATE
Keyobject which implements interface typeRSAPrivateCrtKeywhich uses Chinese Remainder Theorem.- See Also:
- Constant Field Values
-
TYPE_DSA_PUBLIC
public static final byte TYPE_DSA_PUBLIC
Keyobject which implements the interface typeDSAPublicKeyfor the DSA algorithm.- See Also:
- Constant Field Values
-
TYPE_DSA_PRIVATE
public static final byte TYPE_DSA_PRIVATE
Keyobject which implements the interface typeDSAPrivateKeyfor the DSA algorithm.- See Also:
- Constant Field Values
-
TYPE_EC_F2M_PUBLIC
public static final byte TYPE_EC_F2M_PUBLIC
Key object which implements the interface typeECPublicKeyfor EC operations over fields of characteristic 2 with polynomial basis.- See Also:
- Constant Field Values
-
TYPE_EC_F2M_PRIVATE
public static final byte TYPE_EC_F2M_PRIVATE
Key object which implements the interface typeECPrivateKeyfor EC operations over fields of characteristic 2 with polynomial basis.- See Also:
- Constant Field Values
-
TYPE_EC_FP_PUBLIC
public static final byte TYPE_EC_FP_PUBLIC
Key object which implements the interface typeECPublicKeyfor EC operations over large prime fields.- See Also:
- Constant Field Values
-
TYPE_EC_FP_PRIVATE
public static final byte TYPE_EC_FP_PRIVATE
Key object which implements the interface typeECPrivateKeyfor EC operations over large prime fields.- See Also:
- Constant Field Values
-
TYPE_AES_TRANSIENT_RESET
public static final byte TYPE_AES_TRANSIENT_RESET
Keyobject which implements interface typeAESKeywith CLEAR_ON_RESET transient key data.This
Keyobject implicitly performs aclearKey()on power on or card reset.- See Also:
- Constant Field Values
-
TYPE_AES_TRANSIENT_DESELECT
public static final byte TYPE_AES_TRANSIENT_DESELECT
Keyobject which implements interface typeAESKeywith CLEAR_ON_DESELECT transient key data.This
Keyobject implicitly performs aclearKey()on power on, card reset and applet deselection.- See Also:
- Constant Field Values
-
TYPE_AES
public static final byte TYPE_AES
Keyobject which implements interface typeAESKeywith persistent key data.- See Also:
- Constant Field Values
-
TYPE_KOREAN_SEED_TRANSIENT_RESET
public static final byte TYPE_KOREAN_SEED_TRANSIENT_RESET
Keyobject which implements interface typeKoreanSEEDKeywith CLEAR_ON_RESET transient key data.This
Keyobject implicitly performs aclearKey()on power on or card reset.- See Also:
- Constant Field Values
-
TYPE_KOREAN_SEED_TRANSIENT_DESELECT
public static final byte TYPE_KOREAN_SEED_TRANSIENT_DESELECT
Keyobject which implements interface typeKoreanSEEDKeywith CLEAR_ON_DESELECT transient key data.This
Keyobject implicitly performs aclearKey()on power on or card reset.- See Also:
- Constant Field Values
-
TYPE_KOREAN_SEED
public static final byte TYPE_KOREAN_SEED
Keyobject which implements interface typeKoreanSEEDKeywith persistent key data.- See Also:
- Constant Field Values
-
TYPE_HMAC_TRANSIENT_RESET
public static final byte TYPE_HMAC_TRANSIENT_RESET
Keyobject which implements interface typeHMACKeywith CLEAR_ON_RESET transient key data.This
Keyobject implicitly performs aclearKey()on power on or card reset. Note, there is no length constant associated with HMAC, since the specification states that the key can have any length.- See Also:
- Constant Field Values
-
TYPE_HMAC_TRANSIENT_DESELECT
public static final byte TYPE_HMAC_TRANSIENT_DESELECT
Keyobject which implements interface typeHMACKeywith CLEAR_ON_DESELECT transient key data.This
Keyobject implicitly performs aclearKey()on power on or card reset.- See Also:
- Constant Field Values
-
TYPE_HMAC
public static final byte TYPE_HMAC
Keyobject which implements interface typeHMACKeywith persistent key data.- See Also:
- Constant Field Values
-
TYPE_RSA_PRIVATE_TRANSIENT_RESET
public static final byte TYPE_RSA_PRIVATE_TRANSIENT_RESET
Keyobject which implements interface typeRSAPrivateKeywhich uses modulus/exponent form, with CLEAR_ON_RESET transient key data.This
Keyobject implicitly performs aclearKey()on power on or card reset.- See Also:
- Constant Field Values
-
TYPE_RSA_PRIVATE_TRANSIENT_DESELECT
public static final byte TYPE_RSA_PRIVATE_TRANSIENT_DESELECT
Keyobject which implements interface typeRSAPrivateKeywhich uses modulus/exponent form, with CLEAR_ON_DESELECT transient key data.This
Keyobject implicitly performs aclearKey()on power on or card reset.- See Also:
- Constant Field Values
-
TYPE_RSA_CRT_PRIVATE_TRANSIENT_RESET
public static final byte TYPE_RSA_CRT_PRIVATE_TRANSIENT_RESET
Keyobject which implements interface typeRSAPrivateCrtKeywhich uses Chinese Remainder Theorem, with CLEAR_ON_RESET transient key data.This
Keyobject implicitly performs aclearKey()on power on or card reset.- See Also:
- Constant Field Values
-
TYPE_RSA_CRT_PRIVATE_TRANSIENT_DESELECT
public static final byte TYPE_RSA_CRT_PRIVATE_TRANSIENT_DESELECT
Keyobject which implements interface typeRSAPrivateCrtKeywhich uses Chinese Remainder Theorem, with CLEAR_ON_DESELECT transient key data.This
Keyobject implicitly performs aclearKey()on power on or card reset.- See Also:
- Constant Field Values
-
TYPE_DSA_PRIVATE_TRANSIENT_RESET
public static final byte TYPE_DSA_PRIVATE_TRANSIENT_RESET
Keyobject which implements the interface typeDSAPrivateKeyfor the DSA algorithm, with CLEAR_ON_RESET transient key data.This
Keyobject implicitly performs aclearKey()on power on or card reset.- See Also:
- Constant Field Values
-
TYPE_DSA_PRIVATE_TRANSIENT_DESELECT
public static final byte TYPE_DSA_PRIVATE_TRANSIENT_DESELECT
Keyobject which implements the interface typeDSAPrivateKeyfor the DSA algorithm, with CLEAR_ON_DESELECT transient key data.This
Keyobject implicitly performs aclearKey()on power on or card reset.- See Also:
- Constant Field Values
-
TYPE_EC_F2M_PRIVATE_TRANSIENT_RESET
public static final byte TYPE_EC_F2M_PRIVATE_TRANSIENT_RESET
Key object which implements the interface typeECPrivateKeyfor EC operations over fields of characteristic 2 with polynomial basis, with CLEAR_ON_RESET transient key data.This
Keyobject implicitly performs aclearKey()on power on or card reset.- See Also:
- Constant Field Values
-
TYPE_EC_F2M_PRIVATE_TRANSIENT_DESELECT
public static final byte TYPE_EC_F2M_PRIVATE_TRANSIENT_DESELECT
Key object which implements the interface typeECPrivateKeyfor EC operations over fields of characteristic 2 with polynomial basis, with CLEAR_ON_DESELECT transient key data.This
Keyobject implicitly performs aclearKey()on power on or card reset.- See Also:
- Constant Field Values
-
TYPE_EC_FP_PRIVATE_TRANSIENT_RESET
public static final byte TYPE_EC_FP_PRIVATE_TRANSIENT_RESET
Key object which implements the interface typeECPrivateKeyfor EC operations over large prime fields, with CLEAR_ON_RESET transient key data.This
Keyobject implicitly performs aclearKey()on power on or card reset.- See Also:
- Constant Field Values
-
TYPE_EC_FP_PRIVATE_TRANSIENT_DESELECT
public static final byte TYPE_EC_FP_PRIVATE_TRANSIENT_DESELECT
Key object which implements the interface typeECPrivateKeyfor EC operations over large prime fields, with CLEAR_ON_DESELECT transient key data.This
Keyobject implicitly performs aclearKey()on power on or card reset.- See Also:
- Constant Field Values
-
TYPE_DH_PUBLIC
public static final byte TYPE_DH_PUBLIC
Key object which implements the interface typeDHPublicKeyfor DH operations.- See Also:
- Constant Field Values
-
TYPE_DH_PUBLIC_TRANSIENT_DESELECT
public static final byte TYPE_DH_PUBLIC_TRANSIENT_DESELECT
Key object which implements the interface typeDHPublicKeyfor DH operations, . ThisKeyobject implicitly performs aclearKey()on applet deselection, card power on or card reset.- See Also:
- Constant Field Values
-
TYPE_DH_PUBLIC_TRANSIENT_RESET
public static final byte TYPE_DH_PUBLIC_TRANSIENT_RESET
Key object which implements the interface typeDHPublicKeyfor DH operations. ThisKeyobject implicitly performs aclearKey()on card power on or card reset.- See Also:
- Constant Field Values
-
TYPE_DH_PRIVATE
public static final byte TYPE_DH_PRIVATE
Key object which implements the interface typeDHPrivateKeyfor DH operations.- See Also:
- Constant Field Values
-
TYPE_DH_PRIVATE_TRANSIENT_DESELECT
public static final byte TYPE_DH_PRIVATE_TRANSIENT_DESELECT
Key object which implements the interface typeDHPrivateKeyfor DH operations, . ThisKeyobject implicitly performs aclearKey()on applet deselection, card power on or card reset.- See Also:
- Constant Field Values
-
TYPE_DH_PRIVATE_TRANSIENT_RESET
public static final byte TYPE_DH_PRIVATE_TRANSIENT_RESET
Key object which implements the interface typeDHPrivateKeyfor DH operations. ThisKeyobject implicitly performs aclearKey()on card power on or card reset.- See Also:
- Constant Field Values
-
TYPE_DH_PARAMETERS
public static final byte TYPE_DH_PARAMETERS
Keyobject used to provide domain parameter inbuildKeyWithSharedDomain(byte, byte, Key, boolean). as Such instances implement the interface typesDHKeyandKey- Since:
- 3.1
- See Also:
- Constant Field Values
-
TYPE_DSA_PARAMETERS
public static final byte TYPE_DSA_PARAMETERS
Keyobject used to provide domain parameter inbuildKeyWithSharedDomain(byte, byte, Key, boolean). as Such instances implement the interface typesDSAKeyandKey- Since:
- 3.1
- See Also:
- Constant Field Values
-
TYPE_EC_F2M_PARAMETERS
public static final byte TYPE_EC_F2M_PARAMETERS
Keyobject used to provide domain parameter inbuildKeyWithSharedDomain(byte, byte, Key, boolean). as Such instances implement the interface typesECKeyandKey- Since:
- 3.1
- See Also:
- Constant Field Values
-
TYPE_EC_FP_PARAMETERS
public static final byte TYPE_EC_FP_PARAMETERS
Keyobject used to provide domain parameter inbuildKeyWithSharedDomain(byte, byte, Key, boolean). as Such instances implement the interface typesECKeyandKey- Since:
- 3.1
- See Also:
- Constant Field Values
-
TYPE_GENERIC_SECRET
public static final byte TYPE_GENERIC_SECRET
Keyobject which implements interface typeGenericSecretKey.- Since:
- 3.1
- See Also:
- Constant Field Values
-
TYPE_SM4
public static final byte TYPE_SM4
Keyobject which implements interface typeSM4Key.- Since:
- 3.1
- See Also:
- Constant Field Values
-
TYPE_XEC
public static final byte TYPE_XEC
ExtendedKeyobject which implements the interface typeXECKey.This constant is returned when calling
Key.getType()on an extended key created usingbuildXECKey()method. It cannot be used to instantiate a new key usingbuildKey().- Since:
- 3.1
- See Also:
buildXECKey(NamedParameterSpec, short, boolean), Constant Field Values
-
ALG_TYPE_DES
public static final byte ALG_TYPE_DES
Algorithmic key typeALG_TYPE_DESchoice for thealgorithmicKeyTypeparameter of thebuildKey(byte, byte, short, boolean)method. The key instance created implements the interface typeDESKey.- See Also:
- Constant Field Values
-
ALG_TYPE_AES
public static final byte ALG_TYPE_AES
Algorithmic key typeALG_TYPE_AESchoice for thealgorithmicKeyTypeparameter of thebuildKey(byte, byte, short, boolean)method. The key instance created implements the interface typeAESKey.- See Also:
- Constant Field Values
-
ALG_TYPE_DSA_PUBLIC
public static final byte ALG_TYPE_DSA_PUBLIC
Algorithmic key typeALG_TYPE_DSA_PUBLICchoice for thealgorithmicKeyTypeparameter of thebuildKey(byte, byte, short, boolean)method. The key instance created implements the interface typeDSAPublicKey.- See Also:
- Constant Field Values
-
ALG_TYPE_DSA_PRIVATE
public static final byte ALG_TYPE_DSA_PRIVATE
Algorithmic key typeALG_TYPE_DSA_PRIVATEchoice for thealgorithmicKeyTypeparameter of thebuildKey(byte, byte, short, boolean)method. The key instance created implements the interface typeDSAPrivateKey.- See Also:
- Constant Field Values
-
ALG_TYPE_EC_F2M_PUBLIC
public static final byte ALG_TYPE_EC_F2M_PUBLIC
Algorithmic key typeALG_TYPE_EC_F2M_PUBLICchoice for thealgorithmicKeyTypeparameter of thebuildKey(byte, byte, short, boolean)method. The key instance created implements the interface typeECPublicKey.- See Also:
- Constant Field Values
-
ALG_TYPE_EC_F2M_PRIVATE
public static final byte ALG_TYPE_EC_F2M_PRIVATE
Algorithmic key typeALG_TYPE_EC_F2M_PRIVATEchoice for thealgorithmicKeyTypeparameter of thebuildKey(byte, byte, short, boolean)method. The key instance created implements the interface typeECPrivateKey.- See Also:
- Constant Field Values
-
ALG_TYPE_EC_FP_PUBLIC
public static final byte ALG_TYPE_EC_FP_PUBLIC
Algorithmic key typeALG_TYPE_EC_FP_PUBLICchoice for thealgorithmicKeyTypeparameter of thebuildKey(byte, byte, short, boolean)method. The key instance created implements the interface typeECPublicKey.- See Also:
- Constant Field Values
-
ALG_TYPE_EC_FP_PRIVATE
public static final byte ALG_TYPE_EC_FP_PRIVATE
Algorithmic key typeALG_TYPE_EC_FP_PRIVATEchoice for thealgorithmicKeyTypeparameter of thebuildKey(byte, byte, short, boolean)method. The key instance created implements the interface typeECPrivateKey.- See Also:
- Constant Field Values
-
ALG_TYPE_HMAC
public static final byte ALG_TYPE_HMAC
Algorithmic key typeALG_TYPE_HMACchoice for thealgorithmicKeyTypeparameter of thebuildKey(byte, byte, short, boolean)method. The key instance created implements the interface typeHMACKey.- See Also:
- Constant Field Values
-
ALG_TYPE_KOREAN_SEED
public static final byte ALG_TYPE_KOREAN_SEED
Algorithmic key typeALG_TYPE_KOREAN_SEEDchoice for thealgorithmicKeyTypeparameter of thebuildKey(byte, byte, short, boolean)method. The key instance created implements the interface typeKoreanSEEDKey.- See Also:
- Constant Field Values
-
ALG_TYPE_RSA_PUBLIC
public static final byte ALG_TYPE_RSA_PUBLIC
Algorithmic key typeALG_TYPE_RSA_PUBLICchoice for thealgorithmicKeyTypeparameter of thebuildKey(byte, byte, short, boolean)method. The key instance created implements the interface typeRSAPublicKey.- See Also:
- Constant Field Values
-
ALG_TYPE_RSA_PRIVATE
public static final byte ALG_TYPE_RSA_PRIVATE
Algorithmic key typeALG_TYPE_RSA_PRIVATEchoice for thealgorithmicKeyTypeparameter of thebuildKey(byte, byte, short, boolean)method. The key instance created implements the interface typeRSAPrivateKey.- See Also:
- Constant Field Values
-
ALG_TYPE_RSA_CRT_PRIVATE
public static final byte ALG_TYPE_RSA_CRT_PRIVATE
Algorithmic key typeALG_TYPE_RSA_CRT_PRIVATEchoice for thealgorithmicKeyTypeparameter of thebuildKey(byte, byte, short, boolean)method. The key instance created implements the interface typeRSAPrivateCrtKey.- See Also:
- Constant Field Values
-
ALG_TYPE_DH_PUBLIC
public static final byte ALG_TYPE_DH_PUBLIC
Algorithmic key typeALG_TYPE_DH_PUBLICchoice for thealgorithmicKeyTypeparameter of thebuildKey(byte, byte, short, boolean)method. The key instance created implements the interface typeDSAPublicKey.- See Also:
- Constant Field Values
-
ALG_TYPE_DH_PRIVATE
public static final byte ALG_TYPE_DH_PRIVATE
Algorithmic key typeALG_TYPE_DH_PRIVATEchoice for thealgorithmicKeyTypeparameter of thebuildKey(byte, byte, short, boolean)method. The key instance created implements the interface typeDSAPrivateKey.- See Also:
- Constant Field Values
-
ALG_TYPE_EC_F2M_PARAMETERS
public static final byte ALG_TYPE_EC_F2M_PARAMETERS
Algorithmic key typeALG_TYPE_EC_F2M_PARAMETERSchoice for thealgorithmicKeyTypeparameter of thebuildKey(byte, byte, short, boolean)method. The key instance created implements the interface typesECKeyandKey.- See Also:
- Constant Field Values
-
ALG_TYPE_EC_FP_PARAMETERS
public static final byte ALG_TYPE_EC_FP_PARAMETERS
Algorithmic key typeALG_TYPE_EC_FP_PARAMETERSchoice for thealgorithmicKeyTypeparameter of thebuildKey(byte, byte, short, boolean)method. The key instance created implements the interface typesECKeyandKey.- See Also:
- Constant Field Values
-
ALG_TYPE_DSA_PARAMETERS
public static final byte ALG_TYPE_DSA_PARAMETERS
Algorithmic key typeALG_TYPE_DSA_PARAMETERSchoice for thealgorithmicKeyTypeparameter of thebuildKey(byte, byte, short, boolean)method. The key instance created implements the interface typesDSAKeyandKey.- See Also:
- Constant Field Values
-
ALG_TYPE_DH_PARAMETERS
public static final byte ALG_TYPE_DH_PARAMETERS
Algorithmic key typeALG_TYPE_DH_PARAMETERSchoice for thealgorithmicKeyTypeparameter of thebuildKey(byte, byte, short, boolean)method. The key instance created implements the interface typesDHKeyandKey.- See Also:
- Constant Field Values
-
ALG_TYPE_GENERIC_SECRET
public static final byte ALG_TYPE_GENERIC_SECRET
Algorithmic key typeALG_GENERIC_SECRETchoice for thealgorithmicKeyTypeparameter of thebuildKey(byte, byte, short, boolean)method. The key instance created implements the interface typeGenericSecretKey.- Since:
- 3.1
- See Also:
- Constant Field Values
-
ALG_TYPE_SM4
public static final byte ALG_TYPE_SM4
Algorithmic key typeALG_SM4choice for thealgorithmicKeyTypeparameter of thebuildKey(byte, byte, short, boolean)method. The key instance created implements the interface typeSM4Key.- Since:
- 3.1
- See Also:
- Constant Field Values
-
LENGTH_DES
public static final short LENGTH_DES
DES Key LengthLENGTH_DES= 64.- See Also:
- Constant Field Values
-
LENGTH_DES3_2KEY
public static final short LENGTH_DES3_2KEY
DES Key LengthLENGTH_DES3_2KEYfor triple DES algorithm = 128.- See Also:
- Constant Field Values
-
LENGTH_DES3_3KEY
public static final short LENGTH_DES3_3KEY
DES Key LengthLENGTH_DES3_3KEYfor triple DES algorithm = 192.- See Also:
- Constant Field Values
-
LENGTH_RSA_512
public static final short LENGTH_RSA_512
RSA Key LengthLENGTH_RSA_512= 512.- See Also:
- Constant Field Values
-
LENGTH_RSA_736
public static final short LENGTH_RSA_736
RSA Key LengthLENGTH_RSA_736= 736.- See Also:
- Constant Field Values
-
LENGTH_RSA_768
public static final short LENGTH_RSA_768
RSA Key LengthLENGTH_RSA_768= 768.- See Also:
- Constant Field Values
-
LENGTH_RSA_896
public static final short LENGTH_RSA_896
RSA Key LengthLENGTH_RSA_896= 896.- See Also:
- Constant Field Values
-
LENGTH_RSA_1024
public static final short LENGTH_RSA_1024
RSA Key LengthLENGTH_RSA_1024= 1024.- See Also:
- Constant Field Values
-
LENGTH_RSA_1280
public static final short LENGTH_RSA_1280
RSA Key LengthLENGTH_RSA_1280= 1280.- See Also:
- Constant Field Values
-
LENGTH_RSA_1536
public static final short LENGTH_RSA_1536
RSA Key LengthLENGTH_RSA_1536= 1536.- See Also:
- Constant Field Values
-
LENGTH_RSA_1984
public static final short LENGTH_RSA_1984
RSA Key LengthLENGTH_RSA_1984= 1984.- See Also:
- Constant Field Values
-
LENGTH_RSA_2048
public static final short LENGTH_RSA_2048
RSA Key LengthLENGTH_RSA_2048= 2048.- See Also:
- Constant Field Values
-
LENGTH_RSA_3072
public static final short LENGTH_RSA_3072
RSA Key LengthLENGTH_RSA_3072= 3072.- Since:
- 3.0.5
- See Also:
- Constant Field Values
-
LENGTH_RSA_4096
public static final short LENGTH_RSA_4096
RSA Key LengthLENGTH_RSA_4096= 4096.- See Also:
- Constant Field Values
-
LENGTH_DSA_512
public static final short LENGTH_DSA_512
DSA Key LengthLENGTH_DSA_512= 512.- See Also:
- Constant Field Values
-
LENGTH_DSA_768
public static final short LENGTH_DSA_768
DSA Key LengthLENGTH_DSA_768= 768.- See Also:
- Constant Field Values
-
LENGTH_DSA_1024
public static final short LENGTH_DSA_1024
DSA Key LengthLENGTH_DSA_1024= 1024.- See Also:
- Constant Field Values
-
LENGTH_EC_FP_112
public static final short LENGTH_EC_FP_112
EC Key LengthLENGTH_EC_FP_112= 112.- See Also:
- Constant Field Values
-
LENGTH_EC_F2M_113
public static final short LENGTH_EC_F2M_113
EC Key LengthLENGTH_EC_F2M_113= 113.- See Also:
- Constant Field Values
-
LENGTH_EC_FP_128
public static final short LENGTH_EC_FP_128
EC Key LengthLENGTH_EC_FP_128= 128.- See Also:
- Constant Field Values
-
LENGTH_EC_F2M_131
public static final short LENGTH_EC_F2M_131
EC Key LengthLENGTH_EC_F2M_131= 131.- See Also:
- Constant Field Values
-
LENGTH_EC_FP_160
public static final short LENGTH_EC_FP_160
EC Key LengthLENGTH_EC_FP_160= 160.- See Also:
- Constant Field Values
-
LENGTH_EC_F2M_163
public static final short LENGTH_EC_F2M_163
EC Key LengthLENGTH_EC_F2M_163= 163.- See Also:
- Constant Field Values
-
LENGTH_EC_FP_192
public static final short LENGTH_EC_FP_192
EC Key LengthLENGTH_EC_FP_192= 192.- See Also:
- Constant Field Values
-
LENGTH_EC_F2M_193
public static final short LENGTH_EC_F2M_193
EC Key LengthLENGTH_EC_F2M_193= 193.- See Also:
- Constant Field Values
-
LENGTH_EC_FP_224
public static final short LENGTH_EC_FP_224
EC Key LengthLENGTH_EC_FP_224= 224.- See Also:
- Constant Field Values
-
LENGTH_EC_FP_256
public static final short LENGTH_EC_FP_256
EC Key LengthLENGTH_EC_FP_256= 256.- See Also:
- Constant Field Values
-
LENGTH_EC_FP_384
public static final short LENGTH_EC_FP_384
EC Key LengthLENGTH_EC_FP_384= 384.- See Also:
- Constant Field Values
-
LENGTH_EC_FP_521
public static final short LENGTH_EC_FP_521
EC Key LengthLENGTH_EC_FP_521= 521.- See Also:
- Constant Field Values
-
LENGTH_AES_128
public static final short LENGTH_AES_128
AES Key LengthLENGTH_AES_128= 128.- See Also:
- Constant Field Values
-
LENGTH_AES_192
public static final short LENGTH_AES_192
AES Key LengthLENGTH_AES_192= 192.- See Also:
- Constant Field Values
-
LENGTH_AES_256
public static final short LENGTH_AES_256
AES Key LengthLENGTH_AES_256= 256.- See Also:
- Constant Field Values
-
LENGTH_AES_512
public static final short LENGTH_AES_512
AES Key LengthLENGTH_AES_512= 512. This key length must be used to create keys made of two AES-256 sub-keys as required for some algorithms- Since:
- 3.1
- See Also:
Cipher.CIPHER_AES_XTS, Constant Field Values
-
LENGTH_KOREAN_SEED_128
public static final short LENGTH_KOREAN_SEED_128
Korean Seed Key LengthLENGTH_KOREAN_SEED_128= 128.- See Also:
- Constant Field Values
-
LENGTH_HMAC_SHA_1_BLOCK_64
public static final short LENGTH_HMAC_SHA_1_BLOCK_64
HMAC-SHA-1 block lengthLENGTH_HMAC_SHA_1_BLOCK_64= 64 expressed in bytes.Note: This constant should not be used to create an HMAC key which can be of any length and must be expressed in bits within
buildKey(byte, short, boolean)orbuildKey(byte, byte, short, boolean)methods.- See Also:
- Constant Field Values
-
LENGTH_HMAC_SHA_256_BLOCK_64
public static final short LENGTH_HMAC_SHA_256_BLOCK_64
HMAC-SHA-256 block lengthLENGTH_HMAC_SHA_256_BLOCK_64= 64 expressed in bytes.Note: This constant should not be used to create an HMAC key which can be of any length and must be expressed in bits within
buildKey(byte, short, boolean)orbuildKey(byte, byte, short, boolean)methods.- See Also:
- Constant Field Values
-
LENGTH_HMAC_SHA_384_BLOCK_128
public static final short LENGTH_HMAC_SHA_384_BLOCK_128
HMAC-SHA-384 block lengthLENGTH_HMAC_SHA_384_BLOCK_128= 128 expressed in bytes.Note: This constant should not be used to create an HMAC key which can be of any length and must be expressed in bits within
buildKey(byte, short, boolean)orbuildKey(byte, byte, short, boolean)methods.- See Also:
- Constant Field Values
-
LENGTH_HMAC_SHA_512_BLOCK_128
public static final short LENGTH_HMAC_SHA_512_BLOCK_128
HMAC-SHA-512 block lengthLENGTH_HMAC_SHA_512_BLOCK_128= 128 expressed in bytes.Note: This constant should not be used to create an HMAC key which can be of any length and must be expressed in bits within
buildKey(byte, short, boolean)orbuildKey(byte, byte, short, boolean)methods.- See Also:
- Constant Field Values
-
LENGTH_DH_1024
public static final short LENGTH_DH_1024
DH Key LengthLENGTH_DH_1024= 1024.- See Also:
- Constant Field Values
-
LENGTH_DH_2048
public static final short LENGTH_DH_2048
DH Key LengthLENGTH_DH_2048= 2048.- See Also:
- Constant Field Values
-
LENGTH_SM4
public static final short LENGTH_SM4
SM4 Key LengthLENGTH_SM4= 128.- Since:
- 3.1
- See Also:
- Constant Field Values
-
ATTR_PUBLIC
public static final short ATTR_PUBLIC
Key attribute used to create a newXECPublicKeyinstance.
-
ATTR_PRIVATE
public static final short ATTR_PRIVATE
Key attribute used to create a newXECPrivateKeyinstance.
-
-
Method Detail
-
buildKey
public static Key buildKey(byte keyType, short keyLength, boolean keyEncryption) throws CryptoException
Creates uninitialized cryptographic keys for signature and cipher algorithms. Only instances created by this method may be the key objects used to initialize instances ofSignature,CipherandKeyPair. Note that the object returned must be cast to their appropriate key type interface.- Parameters:
keyType- the type of key to be generated. Valid codes listed inTYPE_*constants, for exampleTYPE_DES_TRANSIENT_RESET.keyLength- the key size in bits. The valid key bit lengths are key type dependent. Some common key lengths are listed above above in theLENGTH_*constants, for exampleLENGTH_DES.keyEncryption- iftruethis boolean requests a key implementation which implements thejavacardx.crypto.KeyEncryptioninterface. The key implementation returned may implement thejavacardx.crypto.KeyEncryptioninterface even when this parameter isfalse.- Returns:
- the key object instance of the requested key type, length and encrypted access
- Throws:
CryptoException- with the following reason codes:CryptoException.NO_SUCH_ALGORITHMif the requested algorithm associated with the specified type, size of key and key encryption interface is not supported.
- See Also:
buildKey(byte, byte, short, boolean)
-
buildXECKey
public static Key buildXECKey(NamedParameterSpec params, short attributes, boolean keyEncryption) throws CryptoException
Creates uninitialized cryptographic keys for named curves with predefined elliptic curve domain parameters. Instances created are either implementing theXECPublicKeyinterface or theXECPrivateKeyinterface and can be used to initialize instances ofSignature,Cipher,KeyPairorKeyAgreement.Example:
NamedParameterSpec x25519 = NamedParameterSpec.getInstance(X25519); XECPrivateKey k = KeyBuilder.buildXECKey(x25519, (short)(MEMORY_TYPE_PERSISTENT|ATTR_PRIVATE), false);
- Parameters:
params- named parameters defining the curve domain parametersattributes- the key attributes. Use bitwiseORto select relevant attributes- type of memory for key data storage: use
JCSystem.MEMORY_TYPE_*constants, for exampleMEMORY_TYPE_PERSISTENT. - Asymmetric key type:
ATTR_PUBLICorATTR_PRIVATE. The created key will respectively implementsXECPublicKey interfaceorXECPrivateKey interface
- type of memory for key data storage: use
keyEncryption- iftruethis boolean requests a key implementation which implements thejavacardx.crypto.KeyEncryptioninterface. The key implementation returned may implement thejavacardx.crypto.KeyEncryptioninterface even when this parameter isfalse.- Returns:
- the key object instance of the requested algorithmic key type, key memory storage type, key length and encrypted access required
- Throws:
CryptoException- with the following reason codes:CryptoException.NO_SUCH_ALGORITHMif the requested algorithm associated with the specified algorithmic type, or memory storage type for key, or size of key or key encryption interface requested is not supported.
- Since:
- 3.1
- See Also:
buildKey(byte, short, boolean)
-
buildKey
public static Key buildKey(byte algorithmicKeyType, byte keyMemoryType, short keyLength, boolean keyEncryption) throws CryptoException
Creates uninitialized cryptographic keys for signature and cipher algorithms. Only instances created by this method may be the key objects used to initialize instances ofSignature,CipherandKeyPair. Note that the object returned must be cast to their appropriate key type interface.- Parameters:
algorithmicKeyType- the type of key and algorithm to be generated. Valid codes listed inALG_TYPE_*constants, for exampleALG_TYPE_DES.keyMemoryType- the type of memory for key data storage. Valid codes listed inJCSystem.MEMORY_TYPE_*constants, for exampleMEMORY_TYPE_PERSISTENT.keyLength- the key size in bits. The valid key bit lengths are key type dependent. Some common key lengths are listed above above in theLENGTH_*constants, for exampleLENGTH_DES.keyEncryption- iftruethis boolean requests a key implementation which implements thejavacardx.crypto.KeyEncryptioninterface. The key implementation returned may implement thejavacardx.crypto.KeyEncryptioninterface even when this parameter isfalse.- Returns:
- the key object instance of the requested algorithmic key type, key memory storage type, key length and encrypted access required
- Throws:
CryptoException- with the following reason codes:CryptoException.NO_SUCH_ALGORITHMif the requested algorithm associated with the specified algorithmic type, or memory storage type for key, or size of key or key encryption interface requested is not supported.
- Since:
- 3.0.4
- See Also:
buildKey(byte, short, boolean)
-
getMemoryType
public static byte getMemoryType(Key key)
Get the memory type of the specified key. It corresponds to the memory type specified when building the key withbuildKey(byte, byte, short, boolean)and used to store key material- Parameters:
key- the key instance to query- Returns:
- the memory type of the key
- Since:
- 3.1
- See Also:
JCSystem.MEMORY_TYPE_PERSISTENT,JCSystem.MEMORY_TYPE_TRANSIENT_RESET,JCSystem.MEMORY_TYPE_TRANSIENT_DESELECT
-
buildKeyWithSharedDomain
public static Key buildKeyWithSharedDomain(byte algorithmicKeyType, byte keyMemoryType, Key domainParameters, boolean keyEncryption) throws CryptoException
Creates cryptographic keys for signature and key agreement algorithms. Only instances created by this method may be the key objects used to initialize instances ofSignature,KeyAgreementandKeyPair. Note that the object returned must be cast to their appropriate key type interface.The domain parameters object in the
domainParametersargument is shared with other keys created using the same parameter argument. This means that any changes to the shared parameters - by calling one of the setter methods - will be reflected within the other keys sharing these parameters.The domainParameters argument must be a special parameters object. Parameter objects can be created created using key algorithm types which are suffixed with _PARAMETERS using the
buildKey(byte, byte, short, boolean)method. The key value, such as the secret S or the public point W for an EC Key, or X or Y for DH and DSA Key will never be shared. The key size is determined by information contained in thedomainParametersargument.- Parameters:
algorithmicKeyType- the type of key and algorithm to be generated. Valid codes listed inALG_TYPE_*constants, for exampleALG_TYPE_EC_F2M_PUBLIC.keyMemoryType- the type of memory for key data storage. Valid codes listed inJCSystem.MEMORY_TYPE_*constants, for exampleMEMORY_TYPE_PERSISTENT.domainParameters- a special parameters object containing domain parameters. Parameter objects can be created created using key types which are suffixed with _PARAMETERSkeyEncryption- iftruethis boolean requests a key implementation which implements thejavacardx.crypto.KeyEncryptioninterface. The key implementation returned may implement thejavacardx.crypto.KeyEncryptioninterface even when this parameter isfalse.- Returns:
- the key object instance of the requested key type, length and encrypted access
- Throws:
CryptoException- with the following reason codes:CryptoException.NO_SUCH_ALGORITHMif the requested algorithm associated with the specified type, size of key and key encryption interface is not supported.
-
-