Class NativeSignatureSpi
- java.lang.Object
-
- com.microej.crypto.internal.signature.NativeSignatureSpi
-
public class NativeSignatureSpi extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description NativeSignatureSpi()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidgetAlgOID(byte[] algorithmBytes, byte[] oid, int oidSize)static intnativeGetAlgorithmDescription(byte[] algorithmBytes, byte[] digestAlgorithmName, int digestAlgorithmNameLength)Gets for the given algorithm the signature algorithm description.static intnativeSign(int nativeAlgorithmId, byte[] signature, int signatureLength, int nativeId, byte[] digest, int digestLength)static booleannativeVerify(int nativeAlgorithmId, byte[] signature, int signatureLength, int nativeId, byte[] digest, int digestLength)
-
-
-
Method Detail
-
nativeGetAlgorithmDescription
public static int nativeGetAlgorithmDescription(byte[] algorithmBytes, byte[] digestAlgorithmName, int digestAlgorithmNameLength)Gets for the given algorithm the signature algorithm description.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
ALGORITHMS, so that a lookup allocates nothing.- Parameters:
algorithmBytes- Null terminated string that describes the algorithmdigestAlgorithmName- output buffer receiving the matching digest algorithm name (e.g. "SHA-256" for SHA256withRSA)digestAlgorithmNameLength- the capacity ofdigestAlgorithmName- Returns:
- algorithm ID on success or -1 on error.
-
nativeVerify
public static boolean nativeVerify(int nativeAlgorithmId, byte[] signature, int signatureLength, int nativeId, byte[] digest, int digestLength)
-
nativeSign
public static int nativeSign(int nativeAlgorithmId, byte[] signature, int signatureLength, int nativeId, byte[] digest, int digestLength)
-
getAlgOID
public static void getAlgOID(byte[] algorithmBytes, byte[] oid, int oidSize) throws ej.sni.NativeException, java.security.NoSuchAlgorithmException- Parameters:
algorithmBytes- Null terminated string that describes the algorithmoid- output buffer receiving the OID in dotted-decimal notationoidSize- the capacity ofoid- Throws:
ej.sni.NativeException- on errorjava.security.NoSuchAlgorithmException- ifalgorithmis not in the lookup table
-
-