public final class TLSIdentity extends AbstractTLSIdentity
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.
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,
String alias)
Create self-signed certificate and private key, store them in the canonical keystore,
and return a identity backed by the new entry.
|
static TLSIdentity |
getIdentity(String alias)
Get a TLSIdentity backed by the information for the passed alias.
|
getAlias, getCert, getCerts, getExpiration, getKeyPair
@Nullable public static TLSIdentity getIdentity(@NonNull String alias) throws CouchbaseLiteException
alias
- the keystore alias for the identities entry.CouchbaseLiteException
- on failure to get identity@NonNull public static TLSIdentity createIdentity(boolean isServer, @NonNull Map<String,String> attributes, @Nullable Date expiration, @NonNull String alias) throws CouchbaseLiteException
isServer
- true if this is a server certificateattributes
- certificate attributesexpiration
- expiration datealias
- alias used to identify the key/certificate entry, in the keystoreCouchbaseLiteException
- on failure to get identity