public abstract class LunaCipher
extends javax.crypto.CipherSpi
| Modifier and Type | Class and Description |
|---|---|
protected static class |
LunaCipher.Padding
padding options
|
| Modifier and Type | Field and Description |
|---|---|
protected int |
AES_GCM_GENERATED_IV_LENGTH |
protected int |
bytesCached |
protected int |
keySizeBytes |
protected static java.util.logging.Logger |
LOGGER |
protected byte[] |
mAccumulator |
protected java.security.AlgorithmParameters |
mAlgParams |
protected int |
mBlockSize |
protected boolean |
mHsmOperationActive |
protected LunaKey |
mKey |
protected long |
mMechType |
protected int |
mOpMode |
protected LunaCipher.Padding |
mPadding |
protected boolean |
mStandardSpec |
protected static java.security.SecureRandom |
rand |
| Constructor and Description |
|---|
LunaCipher(long mechType,
java.lang.String keyAlg,
java.lang.String padding,
int blockSize,
boolean singlePart,
boolean standardSpec) |
| Modifier and Type | Method and Description |
|---|---|
protected byte[] |
engineDoFinal(byte[] input,
int inputOffset,
int inputLen) |
protected int |
engineDoFinal(byte[] input,
int inputOffset,
int inputLen,
byte[] output,
int outputOffset) |
protected int |
engineGetBlockSize() |
protected int |
engineGetFinalOutputSize(int inputLen) |
protected byte[] |
engineGetIV() |
protected int |
engineGetKeySize(java.security.Key key)
Returns the key size of the given key object in bits.
|
protected int |
engineGetOutputSize(int inputLen) |
protected java.security.AlgorithmParameters |
engineGetParameters() |
protected int |
engineGetUpdateOutputSize(int inputLen) |
protected void |
engineInit(int opmode,
java.security.Key key,
java.security.SecureRandom random) |
protected void |
engineSetMode(java.lang.String mode) |
protected void |
engineSetPadding(java.lang.String padding) |
protected java.security.Key |
engineUnwrap(byte[] wrappedKey,
java.lang.String wrappedKeyAlgorithm,
int wrappedKeyType)
Unwrap a previously wrapped key.
|
protected byte[] |
engineUpdate(byte[] input,
int inputOffset,
int inputLen) |
protected int |
engineUpdate(byte[] input,
int inputOffset,
int inputLen,
byte[] output,
int outputOffset) |
protected void |
engineUpdateAAD(byte[] src,
int offset,
int len)
Appends authenticated additional data for Authenticated Encryption, Authenticated Decryption for AES GCM.
|
protected byte[] |
engineWrap(java.security.Key key) |
protected void |
finalize() |
protected static final java.util.logging.Logger LOGGER
protected long mMechType
protected int mBlockSize
protected final boolean mStandardSpec
protected java.security.AlgorithmParameters mAlgParams
protected int mOpMode
protected LunaKey mKey
protected int keySizeBytes
protected byte[] mAccumulator
protected LunaCipher.Padding mPadding
protected int bytesCached
protected final int AES_GCM_GENERATED_IV_LENGTH
protected boolean mHsmOperationActive
protected static final java.security.SecureRandom rand
public LunaCipher(long mechType,
java.lang.String keyAlg,
java.lang.String padding,
int blockSize,
boolean singlePart,
boolean standardSpec)
protected void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwableprotected void engineSetMode(java.lang.String mode)
throws java.security.NoSuchAlgorithmException
engineSetMode in class javax.crypto.CipherSpijava.security.NoSuchAlgorithmExceptionprotected void engineSetPadding(java.lang.String padding)
throws javax.crypto.NoSuchPaddingException
engineSetPadding in class javax.crypto.CipherSpijavax.crypto.NoSuchPaddingExceptionprotected byte[] engineGetIV()
engineGetIV in class javax.crypto.CipherSpiprotected int engineGetOutputSize(int inputLen)
engineGetOutputSize in class javax.crypto.CipherSpiprotected int engineGetUpdateOutputSize(int inputLen)
protected int engineGetFinalOutputSize(int inputLen)
protected int engineGetBlockSize()
engineGetBlockSize in class javax.crypto.CipherSpiprotected java.security.AlgorithmParameters engineGetParameters()
engineGetParameters in class javax.crypto.CipherSpiprotected void engineInit(int opmode,
java.security.Key key,
java.security.SecureRandom random)
throws java.security.InvalidKeyException
engineInit in class javax.crypto.CipherSpijava.security.InvalidKeyExceptionprotected byte[] engineUpdate(byte[] input,
int inputOffset,
int inputLen)
engineUpdate in class javax.crypto.CipherSpiprotected int engineUpdate(byte[] input,
int inputOffset,
int inputLen,
byte[] output,
int outputOffset)
throws java.lang.IllegalStateException,
javax.crypto.ShortBufferException
engineUpdate in class javax.crypto.CipherSpijava.lang.IllegalStateExceptionjavax.crypto.ShortBufferExceptionprotected byte[] engineDoFinal(byte[] input,
int inputOffset,
int inputLen)
throws javax.crypto.IllegalBlockSizeException,
javax.crypto.BadPaddingException
engineDoFinal in class javax.crypto.CipherSpijavax.crypto.IllegalBlockSizeExceptionjavax.crypto.BadPaddingExceptionprotected int engineDoFinal(byte[] input,
int inputOffset,
int inputLen,
byte[] output,
int outputOffset)
throws javax.crypto.ShortBufferException,
javax.crypto.IllegalBlockSizeException,
javax.crypto.BadPaddingException
engineDoFinal in class javax.crypto.CipherSpijavax.crypto.ShortBufferExceptionjavax.crypto.IllegalBlockSizeExceptionjavax.crypto.BadPaddingExceptionprotected int engineGetKeySize(java.security.Key key)
throws java.security.InvalidKeyException
engineGetKeySize in class javax.crypto.CipherSpikey - the key to size upjava.security.InvalidKeyException - if the key type is not a Luna or RAW secret key, or an RSA keyprotected java.security.Key engineUnwrap(byte[] wrappedKey,
java.lang.String wrappedKeyAlgorithm,
int wrappedKeyType)
throws java.security.InvalidKeyException
engineUnwrap in class javax.crypto.CipherSpijava.security.InvalidKeyException - if wrappedKey cannot be unwrapped properlyLunaException - if the algorithm parameters can't be used for this unwrap operationprotected byte[] engineWrap(java.security.Key key)
throws javax.crypto.IllegalBlockSizeException,
java.security.InvalidKeyException
engineWrap in class javax.crypto.CipherSpijavax.crypto.IllegalBlockSizeExceptionjava.security.InvalidKeyExceptionprotected void engineUpdateAAD(byte[] src,
int offset,
int len)
engineUpdateAAD in class javax.crypto.CipherSpisrc - buffer with AAD dataoffset - the starting offset from which to copy AADlen - the number of bytes to copy.Copyright 2014-2018 SafeNet. All rights reserved.