Class NativeAESWrapCipherSpi
- java.lang.Object
-
- com.microej.crypto.internal.cipher.NativeAESWrapCipherSpi
-
public class NativeAESWrapCipherSpi extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidnativeClose(int nativeTransformationId, int nativeId)Closes the resource related to the native IDstatic intnativeGetCloseId(int nativeTransformationId)Gets the id of the native close function.static intnativeGetTransformation(byte[] transformationBytes)Gets for the given transformation the cipher id.static intnativeInit(int nativeTransformationId, boolean decrypting, int keyEncryptionKeyId)Initializes a AES Key Wrap resource.static intnativeUnWrap(int nativeTransformationId, int nativeId, byte[] buffer, int bufferOffset, int len, byte[] algorithm)Unwraps a wrapped key blob into an AES data Key.static intnativeWrap(int nativeTransformationId, int nativeId, int keyId, byte[] output, int outputOffset, int outputLength, byte[] algorithm)Wraps a AES data key.
-
-
-
Method Detail
-
nativeGetTransformation
public static int nativeGetTransformation(byte[] transformationBytes)
Gets for the given transformation the cipher id.- Parameters:
transformationBytes- Null terminated string that describes the transformation- Returns:
- transformation ID on success or -1 on error.
-
nativeInit
public static int nativeInit(int nativeTransformationId, boolean decrypting, int keyEncryptionKeyId) throws ej.sni.NativeExceptionInitializes a AES Key Wrap resource.- Parameters:
nativeTransformationId- ID of the transformationdecrypting-truefor wrapping,falsefor unwrapping.keyEncryptionKeyId- the key encryption key id- Returns:
- the nativeId of the newly initialized resource
- Throws:
ej.sni.NativeException- on error.
-
nativeWrap
public static int nativeWrap(int nativeTransformationId, int nativeId, int keyId, byte[] output, int outputOffset, int outputLength, byte[] algorithm) throws ej.sni.NativeExceptionWraps a AES data key.- Parameters:
nativeTransformationId- ID of the transformationnativeId- the resource's native IDkeyId- the key native ID to be wrappedoutput- the output buffer containing the wrapped keyoutputOffset- the output offsetoutputLength- the output lengthalgorithm- the wrapped key algorithm string- Returns:
- the length of the buffer
- Throws:
ej.sni.NativeException- on error
-
nativeUnWrap
public static int nativeUnWrap(int nativeTransformationId, int nativeId, byte[] buffer, int bufferOffset, int len, byte[] algorithm) throws ej.sni.NativeExceptionUnwraps a wrapped key blob into an AES data Key.- Parameters:
nativeTransformationId- ID of the transformationnativeId- the resource's native IDbuffer- the buffer containing the wrapped key blobbufferOffset- the buffer offsetlen- the buffer lengthalgorithm- the wrapped key algorithm string- Returns:
- pointer of the C structure holding the key data
- Throws:
ej.sni.NativeException- on error
-
nativeClose
public static void nativeClose(int nativeTransformationId, int nativeId) throws ej.sni.NativeExceptionCloses the resource related to the native ID- Parameters:
nativeTransformationId- ID of the transformationnativeId- the resource's native ID- Throws:
ej.sni.NativeException- on error
-
nativeGetCloseId
public static int nativeGetCloseId(int nativeTransformationId) throws ej.sni.NativeExceptionGets the id of the native close function.- Parameters:
nativeTransformationId- ID of the transformation- Returns:
- the id of the static native close function
- Throws:
ej.sni.NativeException- on error
-
-