public final class TLSIdentity
extends com.couchbase.lite.internal.AbstractTLSIdentity
TLSIdentity provides the identity information obtained from the given KeyStore, including a private key and X.509 certificate chain. Please note that the private key data will be not extracted out of the KeyStore. The TLSIdentity is used by URLEndpointListener to setup the TLS communication or by the Replicator to setup the client certificate authentication.
CERT_ATTRIBUTE_COMMON_NAME, CERT_ATTRIBUTE_COUNTRY, CERT_ATTRIBUTE_EMAIL_ADDRESS, CERT_ATTRIBUTE_GIVEN_NAME, CERT_ATTRIBUTE_HOSTNAME, CERT_ATTRIBUTE_IP_ADDRESS, CERT_ATTRIBUTE_LOCALITY, CERT_ATTRIBUTE_ORGANIZATION, CERT_ATTRIBUTE_ORGANIZATION_UNIT, CERT_ATTRIBUTE_POSTAL_ADDRESS, CERT_ATTRIBUTE_POSTAL_CODE, CERT_ATTRIBUTE_PSEUDONYM, CERT_ATTRIBUTE_REGISTERED_ID, CERT_ATTRIBUTE_STATE_OR_PROVINCE, CERT_ATTRIBUTE_SURNAME, CERT_ATTRIBUTE_URL
Modifier and Type | Method and Description |
---|---|
static TLSIdentity |
createIdentity(boolean isServer,
Map<String,String> attributes,
Date expiration,
KeyStore keyStore,
String alias,
char[] keyPassword)
Create a self-signed certificate TLSIdentity object.
|
static TLSIdentity |
getIdentity(KeyStore keyStore,
String alias,
char[] keyPassword)
Get a TLSIdentity object from the give KeyStore, key alias, and key password.
|
@Nullable public static TLSIdentity getIdentity(@NonNull KeyStore keyStore, @NonNull String alias, @Nullable char[] keyPassword) throws CouchbaseLiteException
keyStore
- KeyStorealias
- key aliaskeyPassword
- key password if availableCouchbaseLiteException
- on error@NonNull public static TLSIdentity createIdentity(boolean isServer, @NonNull Map<String,String> attributes, @Nullable Date expiration, @NonNull KeyStore keyStore, @NonNull String alias, @Nullable char[] keyPassword) throws CouchbaseLiteException
isServer
- The flag indicating that the certificate is for server or client.attributes
- The certificate attributes.expiration
- The certificate expiration date.keyStore
- The KeyStore object for storing the generated private key and certificate.alias
- The key alias for storing the generated private key and certificate.keyPassword
- The password to protect the private key entry in the KeyStore.CouchbaseLiteException
- on failure