Class TLSIdentity


  • public final class TLSIdentity
    extends BaseTLSIdentity
    ENTERPRISE EDITION API

    TLSIdentity provides the identity information obtained from the given KeyStore, including a private key and X.509 certificate chain. TLSIdentities are backed by the canonical AndroidKeyStore and do not extract private key materials. The TLSIdentity is used by URLEndpointListeners and by Replicator, to set up certificate authenticated TLS communication.

    • Method Detail

      • getIdentity

        @Nullable
        public static TLSIdentity getIdentity​(@NonNull
                                              String alias)
                                       throws CouchbaseLiteException
        Get a TLSIdentity backed by the information for the passed alias.
        Parameters:
        alias - the keystore alias for the identities entry.
        Returns:
        the identity
        Throws:
        CouchbaseLiteException - on failure to get identity
      • createIdentity

        @NonNull
        public static TLSIdentity createIdentity​(boolean isServer,
                                                 @NonNull
                                                 Map<String,​String> attributes,
                                                 @Nullable
                                                 Date expiration,
                                                 @NonNull
                                                 String alias)
                                          throws CouchbaseLiteException
        Create self-signed certificate and private key, store them in the canonical keystore, and return a identity backed by the new entry. The identity will be stored in the secure storage using the specified alias and can be recovered using that alias, after this method returns.
        Parameters:
        isServer - true if this is a server certificate
        attributes - certificate attributes
        expiration - expiration date
        alias - alias used to identify the key/certificate entry, in the keystore
        Returns:
        the new identity
        Throws:
        CouchbaseLiteException - on failure to get identity