Class KeyStoreManager

    • Constructor Detail

      • KeyStoreManager

        public KeyStoreManager()
    • Method Detail

      • getKeyData

        @Nullable
        public abstract byte[] getKeyData​(@NonNull
                                          C4KeyPair keyPair)
        Provides the _public_ key's raw data, as an ASN.1 DER sequence of [modulus, exponent].
        Parameters:
        keyPair - The key pair
        Returns:
        the raw key data or null failure.
      • sign

        @Nullable
        public abstract byte[] sign​(@NonNull
                                    C4KeyPair keyPair,
                                    @NonNull
                                    Signature.SignatureDigestAlgorithm digestAlgorithm,
                                    @NonNull
                                    byte[] data)
        Uses the private key to generate a signature of input data.
        Parameters:
        keyPair - The key pair
        digestAlgorithm - Indicates what type of digest to create the signature from.
        data - The data to be signed.
        Returns:
        the signature (length must be equal to the key size) or null on failure.
      • decrypt

        @Nullable
        public abstract byte[] decrypt​(@NonNull
                                       C4KeyPair keyPair,
                                       @NonNull
                                       byte[] data)
        Decrypts data using the private key.
        Parameters:
        keyPair - The key pair
        data - The data to be encrypted.
        Returns:
        the raw key data or null failure.
      • free

        public abstract void free​(@NonNull
                                  C4KeyPair keyPair)
        Called when the C4KeyPair is released and the externalKey is no longer needed and when associated resources may be freed
        Parameters:
        keyPair - The key pair
      • getKey

        @Nullable
        public abstract PrivateKey getKey​(@Nullable
                                          KeyStore keyStore,
                                          @NonNull
                                          String keyAlias,
                                          @Nullable
                                          char[] keyPassword)
      • getCertificateChain

        @Nullable
        public abstract List<Certificate> getCertificateChain​(@Nullable
                                                              KeyStore keyStore,
                                                              @NonNull
                                                              String keyAlias)