public class SymmetricKeyImpl extends KeyImpl implements javacard.security.DESKey, javacard.security.AESKey, javacard.security.HMACKey
DESKey,
AESKey| Modifier and Type | Field and Description |
|---|---|
protected ByteContainer |
key |
| Constructor and Description |
|---|
SymmetricKeyImpl(byte keyType,
short keySize)
Create new instance of
SymmetricKeyImpl |
| Modifier and Type | Method and Description |
|---|---|
void |
clearKey()
Clears the key and sets its initialized state to false.
|
org.bouncycastle.crypto.BlockCipher |
getCipher()
Return the BouncyCastle
BlockCipher for using with this key |
byte |
getKey(byte[] keyData,
short kOff)
Returns the
Key data in plain text. |
org.bouncycastle.crypto.KeyGenerationParameters |
getKeyGenerationParameters(SecureRandom rnd)
Get keypair generation parameters for use with BouncyCastle Crypto API
|
org.bouncycastle.crypto.CipherParameters |
getParameters()
Return the BouncyCastle
KeyParameter of the key |
boolean |
isInitialized() |
void |
setKey(byte[] keyData,
short kOff)
Sets the
Key data. |
void |
setKey(byte[] keyData,
short kOff,
short kLen)
Sets the
Key data. |
void |
setParameters(org.bouncycastle.crypto.CipherParameters params)
Set cipher key for use with BouncyCastle Crypto API
|
protected ByteContainer key
public SymmetricKeyImpl(byte keyType,
short keySize)
SymmetricKeyImplkeyType - keyType interfacekeySize - keySize in bitsKeyBuilderpublic void clearKey()
clearKey in interface javacard.security.Keypublic void setKey(byte[] keyData,
short kOff)
throws javacard.security.CryptoException,
NullPointerException,
ArrayIndexOutOfBoundsException
Key data.setKey in interface javacard.security.AESKeysetKey in interface javacard.security.DESKeyjavacard.security.CryptoExceptionNullPointerExceptionArrayIndexOutOfBoundsExceptionpublic void setKey(byte[] keyData,
short kOff,
short kLen)
throws javacard.security.CryptoException,
NullPointerException,
ArrayIndexOutOfBoundsException
Key data.setKey in interface javacard.security.HMACKeyjavacard.security.CryptoExceptionNullPointerExceptionArrayIndexOutOfBoundsExceptionpublic byte getKey(byte[] keyData,
short kOff)
Key data in plain text.getKey in interface javacard.security.AESKeygetKey in interface javacard.security.DESKeygetKey in interface javacard.security.HMACKeypublic void setParameters(org.bouncycastle.crypto.CipherParameters params)
KeyWithParameterssetParameters in interface KeyWithParametersparams - key parameterspublic org.bouncycastle.crypto.CipherParameters getParameters()
throws javacard.security.CryptoException
KeyParameter of the keygetParameters in interface KeyWithParametersjavacard.security.CryptoException - if key not initializedKeyParameterpublic org.bouncycastle.crypto.BlockCipher getCipher()
throws javacard.security.CryptoException
BlockCipher for using with this keyBlockCipher for this key, or null for HMACKeyjavacard.security.CryptoException - if key not initializedBlockCipherpublic boolean isInitialized()
isInitialized in interface javacard.security.Keypublic org.bouncycastle.crypto.KeyGenerationParameters getKeyGenerationParameters(SecureRandom rnd)
KeyWithParametersgetKeyGenerationParameters in interface KeyWithParametersrnd - Secure Random Generator