Class NativeSignatureSpi


  • public class NativeSignatureSpi
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void getAlgOID​(byte[] algorithmBytes, byte[] oid, int oidSize)  
      static int nativeGetAlgorithmDescription​(byte[] algorithmBytes, byte[] digestAlgorithmName, int digestAlgorithmNameLength)
      Gets for the given algorithm the signature algorithm description.
      static int nativeSign​(int nativeAlgorithmId, byte[] signature, int signatureLength, int nativeId, byte[] digest, int digestLength)  
      static boolean nativeVerify​(int nativeAlgorithmId, byte[] signature, int signatureLength, int nativeId, byte[] digest, int digestLength)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • NativeSignatureSpi

        public NativeSignatureSpi()
    • 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 algorithm
        digestAlgorithmName - output buffer receiving the matching digest algorithm name (e.g. "SHA-256" for SHA256withRSA)
        digestAlgorithmNameLength - the capacity of digestAlgorithmName
        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 algorithm
        oid - output buffer receiving the OID in dotted-decimal notation
        oidSize - the capacity of oid
        Throws:
        ej.sni.NativeException - on error
        java.security.NoSuchAlgorithmException - if algorithm is not in the lookup table