Interface KeyStore


  • @Role
    public interface KeyStore
    Store and retrieve private key from a key store.
    Since:
    6.1M2
    Version:
    $Id: 48c57f06586e2ccffe235f0a57b2534241c15e5d $
    • Method Detail

      • store

        void store​(StoreReference store,
                   CertifiedKeyPair keyPair)
            throws KeyStoreException
        Store a private key and its certificate into a given store. NOT VERY SECURE, since the key will be store AS IS without encryption.
        Parameters:
        store - the store where to save the key and its certificate.
        keyPair - the key pair to be stored.
        Throws:
        KeyStoreException - on error.
      • store

        void store​(StoreReference store,
                   CertifiedKeyPair keyPair,
                   byte[] password)
            throws KeyStoreException
        Store a private key and its certificate into a given store, encrypting the key with a password.
        Parameters:
        store - the store where to save the key and its certificate.
        keyPair - the key pair to be stored.
        password - the password to encrypt the private key.
        Throws:
        KeyStoreException - on error.
      • retrieve

        CertifiedKeyPair retrieve​(StoreReference store)
                           throws KeyStoreException
        Retrieve a private key from a given store that may contains only a single key.
        Parameters:
        store - the single-key store where the key is stored with its certificate.
        Returns:
        the certified key pair, or null if none have been found.
        Throws:
        KeyStoreException - on error.
      • retrieve

        CertifiedKeyPair retrieve​(StoreReference store,
                                  byte[] password)
                           throws KeyStoreException
        Retrieve the certified key pair from a given store that may contains only a single key and decrypt it using the given password.
        Parameters:
        store - the single-key store where the key is stored encrypted with its certificate.
        password - the password to decrypt the private key.
        Returns:
        the certified key pair, or null if none have been found.
        Throws:
        KeyStoreException - on error.
      • retrieve

        CertifiedKeyPair retrieve​(StoreReference store,
                                  CertifiedPublicKey publicKey)
                           throws KeyStoreException
        Retrieve the certified key pair from a given store that match the given certificate.
        Parameters:
        store - the multi-key store where the key has been stored with its certificate.
        publicKey - for which the private key is requested.
        Returns:
        the certified key pair corresponding to the given certificate, or null if none have been found.
        Throws:
        KeyStoreException - on error.
      • retrieve

        CertifiedKeyPair retrieve​(StoreReference store,
                                  CertifiedPublicKey publicKey,
                                  byte[] password)
                           throws KeyStoreException
        Retrieve the certified key pair from a given store that match the given certificate and decrypt it using the given password.
        Parameters:
        store - the multi-key store where the key has been stored encrypted with its certificate
        publicKey - for which the private key is requested.
        password - the password to decrypt the private key.
        Returns:
        the certified key pair corresponding to the given certificate, or null if none have been found.
        Throws:
        KeyStoreException - on error.