Class NativeKeyFactorySpi


  • public class NativeKeyFactorySpi
    extends java.lang.Object
    Mock implementation for LLAPI: LLSEC_KEY_FACTORY
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int ecPublicKeyFromRaw​(byte[] curveName, byte[] x, byte[] y)  
      static int nativeGetAlgorithmDescription​(byte[] algorithmBytes)
      On a device an algorithm id is a constant that the LLAPI returns, and Managed Code never closes it.
      static int nativeGetPrivateKeyCloseId​(int nativeAlgorithmId)
      Gets the id of the native close function.
      static int nativeGetPrivateKeyData​(int nativeAlgorithmId, byte[] formatBytes, byte[] encodedKey, int encodedKeyLength)  
      static int nativeGetPublicKeyCloseId​(int nativeAlgorithmId)
      Gets the id of the native close function.
      static int nativeGetPublicKeyData​(int nativeAlgId, byte[] formatBytes, byte[] encodedKey, int encodedKeyLength)  
      • Methods inherited from class java.lang.Object

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

      • NativeKeyFactorySpi

        public NativeKeyFactorySpi()
    • 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 in ALGORITHM_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 ID
        formatBytes - the format of the encoded key
        encodedKey - the encoded private key
        encodedKeyLength - 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)