Class NativeRSACipherSpi
- java.lang.Object
-
- com.microej.crypto.internal.cipher.NativeRSACipherSpi
-
public class NativeRSACipherSpi extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description NativeRSACipherSpi()
-
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 intnativeDecrypt(int nativeTransformationId, int nativeId, byte[] buffer, int bufferOffset, int len, byte[] output, int outputOffset)Decrypts the message contained inbuffer.static intnativeEncrypt(int nativeTransformationId, int nativeId, byte[] buffer, int bufferOffset, int len, byte[] output, int outputOffset)Encrypts the message contained inbuffer.static intnativeGetCloseId(int nativeTransformationId)Gets the id of the native close function.static intnativeGetTransformationDescription(byte[] transformation, byte[] description)Gets for the given transformation the cipher description.static intnativeInit(int nativeTransformationId, boolean decrypting, int keyNativeId, int padding, int hash)Initializes a Cipher resource.
-
-
-
Method Detail
-
nativeGetTransformationDescription
public static int nativeGetTransformationDescription(byte[] transformation, byte[] description)Gets for the given transformation the cipher description.- Parameters:
transformation- Null terminated string that describes the transformationdescription- must be filled-in with:- [0-3]: paddingType: one of the
PAD_*values defined inNativeRSACipherSpi - [4-7]: oaepHashAlgorithm: one of the
OAEP_HASH_*values defined inNativeRSACipherSpi
- [0-3]: paddingType: one of the
- Returns:
- transformation ID on success or -1 on error.
-
nativeInit
public static int nativeInit(int nativeTransformationId, boolean decrypting, int keyNativeId, int padding, int hash) throws ej.sni.NativeExceptionInitializes a Cipher resource.- Parameters:
nativeTransformationId- ID of the transformationdecrypting-truefor decrypting,falsefor encryting.keyNativeId- ID of the key used by the cipherpadding- padding mode used by the cipherhash- hash algorithm used by the cipher- Returns:
- the nativeId of the newly initialized resource
- Throws:
ej.sni.NativeException- on error.
-
nativeEncrypt
public static int nativeEncrypt(int nativeTransformationId, int nativeId, byte[] buffer, int bufferOffset, int len, byte[] output, int outputOffset) throws ej.sni.NativeExceptionEncrypts the message contained inbuffer.- Parameters:
nativeTransformationId- ID of the transformationnativeId- the resource's native IDbuffer- the buffer containing the plaintext message to encryptbufferOffset- the buffer offsetlen- the buffer lengthoutput- the output buffer containing the encrypted messageoutputOffset- the output offset- Returns:
- the length of the buffer
- Throws:
ej.sni.NativeException- on error
-
nativeDecrypt
public static int nativeDecrypt(int nativeTransformationId, int nativeId, byte[] buffer, int bufferOffset, int len, byte[] output, int outputOffset) throws ej.sni.NativeExceptionDecrypts the message contained inbuffer.- Parameters:
nativeTransformationId- ID of the transformationnativeId- the resource's native IDbuffer- the buffer containing the message to decryptbufferOffset- the buffer offsetlen- the buffer lengthoutput- the output buffer containing the plaintext messageoutputOffset- the output offset- Returns:
- the length of the buffer
- 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
-
-