Class NativeKeyFactorySpi
- java.lang.Object
-
- com.microej.crypto.internal.keyfactory.NativeKeyFactorySpi
-
public class NativeKeyFactorySpi extends java.lang.ObjectMock implementation for LLAPI: LLSEC_KEY_FACTORY
-
-
Constructor Summary
Constructors Constructor Description NativeKeyFactorySpi()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intecPublicKeyFromRaw(byte[] curveName, byte[] x, byte[] y)static intnativeGetAlgorithmDescription(byte[] algorithmBytes)On a device an algorithm id is a constant that the LLAPI returns, and Managed Code never closes it.static intnativeGetPrivateKeyCloseId(int nativeAlgorithmId)Gets the id of the native close function.static intnativeGetPrivateKeyData(int nativeAlgorithmId, byte[] formatBytes, byte[] encodedKey, int encodedKeyLength)static intnativeGetPublicKeyCloseId(int nativeAlgorithmId)Gets the id of the native close function.static intnativeGetPublicKeyData(int nativeAlgId, byte[] formatBytes, byte[] encodedKey, int encodedKeyLength)
-
-
-
Method Detail
-
nativeGetAlgorithmDescription
public static int nativeGetAlgorithmDescription(byte[] algorithmBytes)
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 inALGORITHM_NAMES, and rebuilds the 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.
-
nativeGetPrivateKeyData
public static int nativeGetPrivateKeyData(int nativeAlgorithmId, byte[] formatBytes, byte[] encodedKey, int encodedKeyLength)- Parameters:
nativeAlgorithmId- the algorithm IDformatBytes- the format of the encoded keyencodedKey- the encoded private keyencodedKeyLength- the length of the encoded key- Returns:
- the registered native resource id, or -1 on error.
-
nativeGetPublicKeyData
public static int nativeGetPublicKeyData(int nativeAlgId, byte[] formatBytes, byte[] encodedKey, int encodedKeyLength)
-
nativeGetPublicKeyCloseId
public static int nativeGetPublicKeyCloseId(int nativeAlgorithmId)
Gets the id of the native close function.- Parameters:
nativeAlgorithmId- the algorithm ID- Returns:
- the id of the static native close function
- Throws:
ej.sni.NativeException- on error
-
nativeGetPrivateKeyCloseId
public static int nativeGetPrivateKeyCloseId(int nativeAlgorithmId)
Gets the id of the native close function.- Parameters:
nativeAlgorithmId- the algorithm ID- Returns:
- the id of the static native close function
- Throws:
ej.sni.NativeException- on error
-
ecPublicKeyFromRaw
public static int ecPublicKeyFromRaw(byte[] curveName, byte[] x, byte[] y)
-
-