Package com.couchbase.lite.internal
Class KeyStoreManager
- java.lang.Object
-
- com.couchbase.lite.internal.KeyStoreManager
-
- Direct Known Subclasses:
KeyStoreManagerDelegate
public abstract class KeyStoreManager extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classKeyStoreManager.CertUsagestatic classKeyStoreManager.KeyAlgorithmstatic classKeyStoreManager.KeySize
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringANON_COMMON_NAMEstatic intANON_EXPIRATION_YEARSstatic java.lang.StringANON_IDENTITY_ALIAS
-
Constructor Summary
Constructors Constructor Description KeyStoreManager()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static voidcheckAlias(java.lang.String alias)abstract voidcreateSelfSignedCertEntry(java.security.KeyStore keyStore, java.lang.String alias, char[] keyPassword, boolean isServer, java.util.Map<java.lang.String,java.lang.String> attributes, java.util.Date expiration)abstract byte[]decrypt(C4KeyPair keyPair, byte[] data)Decrypts data using the private key.abstract intdeleteEntries(java.security.KeyStore keyStore, Fn.Predicate<java.lang.String> filter)abstract booleanfindAlias(java.security.KeyStore keyStore, java.lang.String targetAlias)abstract voidfree(C4KeyPair keyPair)Called when the C4KeyPair is released and the externalKey is no longer needed and when associated resources may be freedabstract java.util.List<java.security.cert.Certificate>getCertificateChain(java.security.KeyStore keyStore, java.lang.String keyAlias)static KeyStoreManagergetInstance()abstract java.security.PrivateKeygetKey(java.security.KeyStore keyStore, java.lang.String keyAlias, char[] keyPassword)abstract byte[]getKeyData(C4KeyPair keyPair)Provides the _public_ key's raw data, as an ASN.1 DER sequence of [modulus, exponent].static voidsetInstance(KeyStoreManager mgr)abstract byte[]sign(C4KeyPair keyPair, Signature.SignatureDigestAlgorithm digestAlgorithm, byte[] data)Uses the private key to generate a signature of input data.
-
-
-
Field Detail
-
ANON_IDENTITY_ALIAS
public static final java.lang.String ANON_IDENTITY_ALIAS
- See Also:
- Constant Field Values
-
ANON_COMMON_NAME
public static final java.lang.String ANON_COMMON_NAME
- See Also:
- Constant Field Values
-
ANON_EXPIRATION_YEARS
public static final int ANON_EXPIRATION_YEARS
- See Also:
- Constant Field Values
-
-
Method Detail
-
getInstance
@NonNull public static KeyStoreManager getInstance()
-
checkAlias
public static void checkAlias(@NonNull java.lang.String alias) throws CouchbaseLiteException- Throws:
CouchbaseLiteException
-
setInstance
public static void setInstance(KeyStoreManager mgr)
-
getKeyData
@Nullable public abstract byte[] getKeyData(@NonNull C4KeyPair keyPair)Provides the _public_ key's raw data, as an ASN.1 DER sequence of [modulus, exponent].- Parameters:
keyPair- The key pair- Returns:
- the raw key data or null failure.
-
sign
@Nullable public abstract byte[] sign(@NonNull C4KeyPair keyPair, @NonNull Signature.SignatureDigestAlgorithm digestAlgorithm, @NonNull byte[] data)Uses the private key to generate a signature of input data.- Parameters:
keyPair- The key pairdigestAlgorithm- Indicates what type of digest to create the signature from.data- The data to be signed.- Returns:
- the signature (length must be equal to the key size) or null on failure.
-
decrypt
@Nullable public abstract byte[] decrypt(@NonNull C4KeyPair keyPair, @NonNull byte[] data)Decrypts data using the private key.- Parameters:
keyPair- The key pairdata- The data to be encrypted.- Returns:
- the raw key data or null failure.
-
free
public abstract void free(@NonNull C4KeyPair keyPair)Called when the C4KeyPair is released and the externalKey is no longer needed and when associated resources may be freed- Parameters:
keyPair- The key pair
-
findAlias
public abstract boolean findAlias(@Nullable java.security.KeyStore keyStore, @NonNull java.lang.String targetAlias) throws CouchbaseLiteException- Throws:
CouchbaseLiteException
-
getKey
@Nullable public abstract java.security.PrivateKey getKey(@Nullable java.security.KeyStore keyStore, @NonNull java.lang.String keyAlias, @Nullable char[] keyPassword)
-
getCertificateChain
@Nullable public abstract java.util.List<java.security.cert.Certificate> getCertificateChain(@Nullable java.security.KeyStore keyStore, @NonNull java.lang.String keyAlias)
-
createSelfSignedCertEntry
public abstract void createSelfSignedCertEntry(@Nullable java.security.KeyStore keyStore, @NonNull java.lang.String alias, @Nullable char[] keyPassword, boolean isServer, @NonNull java.util.Map<java.lang.String,java.lang.String> attributes, @Nullable java.util.Date expiration) throws CouchbaseLiteException- Throws:
CouchbaseLiteException
-
deleteEntries
public abstract int deleteEntries(@Nullable java.security.KeyStore keyStore, Fn.Predicate<java.lang.String> filter) throws CouchbaseLiteException- Throws:
CouchbaseLiteException
-
-