Class C4KeyPair

    • Method Detail

      • createKeyPair

        @NonNull
        public static C4KeyPair createKeyPair​(@Nullable
                                              KeyStore keyStore,
                                              @NonNull
                                              String keyAlias,
                                              @Nullable
                                              char[] keyPassword,
                                              @NonNull
                                              KeyStoreManager.KeyAlgorithm algorithm,
                                              @NonNull
                                              KeyStoreManager.KeySize keySize)
                                       throws CouchbaseLiteException
        Create a C4Key pair.
        Parameters:
        keyStore - the KeyStore object containing the cert and key pair
        keyAlias - the alias by which the key is known to the keystore
        keyPassword - the password protecting the key
        algorithm - key algorithm (must be KeyManager.KeyAlgorithm.RSA)
        keySize - key size
        Returns:
        a new C4KeyPair, representing the cert, public and private keys identified by the alias
        Throws:
        CouchbaseLiteException - on error
      • createKeyPair

        @NonNull
        public static C4KeyPair createKeyPair​(@Nullable
                                              KeyStore keyStore,
                                              @NonNull
                                              String keyAlias,
                                              @Nullable
                                              char[] keyPassword,
                                              @NonNull
                                              KeyStoreManager.KeyAlgorithm algorithm,
                                              @NonNull
                                              KeyStoreManager.KeySize keySize,
                                              @Nullable
                                              KeyPair keys)
                                       throws CouchbaseLiteException
        Create a C4Key pair.
        Parameters:
        keyStore - the KeyStore object containing the cert and key pair
        keyAlias - the alias by which the key is known to the keystore
        keyPassword - the password protecting the key
        algorithm - key algorithm (must be KeyManager.KeyAlgorithm.RSA)
        keySize - key size
        keys - keyPair for the case that the KeyPair hasn't been saved into the KeyStore
        Returns:
        a new C4KeyPair, representing the cert, public and private keys identified by the alias
        Throws:
        CouchbaseLiteException - on error
      • createKeyPair

        @NonNull
        public static C4KeyPair createKeyPair​(@NonNull
                                              String keyAlias,
                                              @NonNull
                                              KeyStoreManager.KeyAlgorithm algorithm,
                                              @NonNull
                                              KeyStoreManager.KeySize keySize)
                                       throws CouchbaseLiteException
        Convenience method for Android, which has only one safe keystore and doesn't use passwords for keys.
        Parameters:
        keyAlias - the alias by which the key is known to the keystore
        algorithm - key algorithm (must be KeyManager.KeyAlgorithm.RSA)
        keySize - key size
        Returns:
        a new C4KeyPair, representing the cert, public and private keys identified by the alias
        Throws:
        CouchbaseLiteException - on error
      • getKeyStore

        @Nullable
        public KeyStore getKeyStore()
      • getKeyAlias

        @NonNull
        public String getKeyAlias()
      • getKeyPassword

        @Nullable
        public char[] getKeyPassword()
      • getKeys

        @Nullable
        public KeyPair getKeys()
      • close

        @CallSuper
        public void close()