Class NativeSecretKeyFactorySpi
- java.lang.Object
-
- com.microej.crypto.internal.secretkey.NativeSecretKeyFactorySpi
-
public class NativeSecretKeyFactorySpi extends java.lang.ObjectNativeSecretKeyFactoryGenerator Service Provider Mock
-
-
Constructor Summary
Constructors Constructor Description NativeSecretKeyFactorySpi()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intnativeGetAlgorithm(byte[] algorithmBytes)Get the supported algorithm native ID.static intnativeGetCloseId(int algorithmId)Gets the id of the native close function.static intnativeGetKeyData(int algorithmId, byte[] password, int passwordLength, byte[] salt, int saltLength, int iterations, int keyLength)Generate a Password Based Encryption Key from the encoded key format.
-
-
-
Method Detail
-
nativeGetAlgorithm
public static int nativeGetAlgorithm(byte[] algorithmBytes)
Get the supported algorithm native ID.On a device an algorithm id is a constant that the LLAPI returns, and Managed Code never closes it. The mock therefore encodes it as an index in
ALGORITHM_NAMES, and rebuilds the secret key factory on each use, so that a lookup allocates nothing.- Parameters:
algorithmBytes- Null terminated string that describes the algorithm- Returns:
- algorithm ID on success or -1 on error.
-
nativeGetKeyData
public static int nativeGetKeyData(int algorithmId, byte[] password, int passwordLength, byte[] salt, int saltLength, int iterations, int keyLength)Generate a Password Based Encryption Key from the encoded key format.- Parameters:
algorithmId- the algorithm IDpassword- the password to encode, a null terminated '\0' byte array representation of the format in StringpasswordLength- the length of passwordsalt- saltysaltLength- saltyiterations- number of iterationskeyLength- the length of encodedKey to generate (in bits)- Returns:
- the pointer of the C structure holding the key data
- Throws:
ej.sni.NativeException- on error
-
nativeGetCloseId
public static int nativeGetCloseId(int algorithmId)
Gets the id of the native close function.- Parameters:
algorithmId- the algorithm ID- Returns:
- the id of the static native close function
- Throws:
ej.sni.NativeException- on error
-
-