Interface KeyStore


  • public interface KeyStore
    Keymanager interface that handles and stores its cryptographic keys.
    Since:
    1.0.0
    Author:
    Dharmesh Khandelwal
    • Method Detail

      • getPrivateKey

        PrivateKey getPrivateKey​(String alias)
        Get private key from keystore
        Parameters:
        alias - the alias
        Returns:
        The private key
      • getPublicKey

        PublicKey getPublicKey​(String alias)
        Get public key from keystore
        Parameters:
        alias - the alias
        Returns:
        The public key
      • getCertificate

        Certificate getCertificate​(String alias)
        Get certificate from keystore
        Parameters:
        alias - the alias
        Returns:
        The certificate
      • getSymmetricKey

        SecretKey getSymmetricKey​(String alias)
        Get Symmetric key from keystore
        Parameters:
        alias - the alias
        Returns:
        The Symmetric key
      • getAsymmetricKey

        KeyStore.PrivateKeyEntry getAsymmetricKey​(String alias)
        Get Asymmetric key from keystore
        Parameters:
        alias - the alias
        Returns:
        The asymmetric key
      • getAllAlias

        List<String> getAllAlias()
        Lists all the alias names of this keystore.
        Returns:
        list of all alias in keystore
      • getKey

        Key getKey​(String alias)
        Returns the key associated with the given alias, using the given password to recover it. The key must have been associated with the alias by a call to setKeyEntry, or by a call to setEntry with a PrivateKeyEntry or SecretKeyEntry.
        Parameters:
        alias - the alias
        Returns:
        the requested key, or null if the given alias does not exist or does not identify a key-related entry
      • generateAndStoreSymmetricKey

        void generateAndStoreSymmetricKey​(String alias)
        Symmetric key will be generated based on the provider specified and Store the key in provider specific keystore
        Parameters:
        secretKey - the secret key
        alias - the alias
      • generateAndStoreAsymmetricKey

        void generateAndStoreAsymmetricKey​(String alias,
                                           String signKeyAlias,
                                           CertificateParameters certParams)
        Asymmetric(keypair) keys will be generated based on the provider specified and Store the keys along with self-signed certificate in provider specific keystore
        Parameters:
        alias - the alias
        signKeyAlias - alias used to sign the generated key
        certParams - required Certificate Parameters to create the certificate
      • deleteKey

        void deleteKey​(String alias)
        Delete key form keystore
        Parameters:
        alias - the alias
      • storeCertificate

        void storeCertificate​(String alias,
                              PrivateKey privateKey,
                              Certificate certificate)
        Stores the given trusted certificate to the given alias
        Parameters:
        alias - the alias
        privateKey - privateKey reference of the provided certificate
        certificate - Certificate to be stored
      • getKeystoreProviderName

        String getKeystoreProviderName()
        Gets the keyStore provider name.