public class AndroidSqlite3IdentityStorage extends Sqlite3IdentityStorageBase
INIT_CERT_TABLE1, INIT_CERT_TABLE2, INIT_CERT_TABLE3, INIT_ID_TABLE1, INIT_ID_TABLE2, INIT_KEY_TABLE1, INIT_KEY_TABLE2, INIT_TPM_INFO_TABLE, SELECT_doesCertificateExist, SELECT_doesIdentityExist, SELECT_doesKeyExist, SELECT_getAllCertificateNamesOfKey_default_false, SELECT_getAllCertificateNamesOfKey_default_true, SELECT_getAllIdentities_default_false, SELECT_getAllIdentities_default_true, SELECT_getAllKeyNamesOfIdentity_default_false, SELECT_getAllKeyNamesOfIdentity_default_true, SELECT_getCertificate, SELECT_getDefaultCertificateNameForKey, SELECT_getDefaultIdentity, SELECT_getDefaultKeyNameForIdentity, SELECT_getKey, SELECT_getTpmLocator, SELECT_MASTER_CERT_TABLE, SELECT_MASTER_ID_TABLE, SELECT_MASTER_KEY_TABLE, SELECT_MASTER_TPM_INFO_TABLE, WHERE_deleteCertificateInfo, WHERE_deleteIdentityInfo, WHERE_deletePublicKeyInfo, WHERE_setDefaultCertificateNameForKey_reset, WHERE_setDefaultCertificateNameForKey_set, WHERE_setDefaultIdentity_reset, WHERE_setDefaultIdentity_set, WHERE_setDefaultKeyNameForIdentity_reset, WHERE_setDefaultKeyNameForIdentity_set, WHERE_updateKeyStatus| Constructor and Description |
|---|
AndroidSqlite3IdentityStorage(String databaseFilePath)
Create a new AndroidSqlite3IdentityStorage to use the given full path of
the SQLite3 file.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addCertificate(IdentityCertificate certificate)
Add a certificate to the identity storage.
|
void |
addIdentity(Name identityName)
Add a new identity.
|
void |
addKey(Name keyName,
KeyType keyType,
Blob publicKeyDer)
Add a public key to the identity storage.
|
void |
deleteCertificateInfo(Name certificateName)
Delete a certificate.
|
void |
deleteIdentityInfo(Name identityName)
Delete an identity and related public keys and certificates.
|
void |
deletePublicKeyInfo(Name keyName)
Delete a public key and related certificates.
|
boolean |
doesCertificateExist(Name certificateName)
Check if the specified certificate already exists.
|
boolean |
doesIdentityExist(Name identityName)
Check if the specified identity already exists.
|
boolean |
doesKeyExist(Name keyName)
Check if the specified key already exists.
|
void |
getAllCertificateNamesOfKey(Name keyName,
ArrayList nameList,
boolean isDefault)
Append all the certificate names of a particular key name to the nameList.
|
void |
getAllIdentities(ArrayList nameList,
boolean isDefault)
Append all the identity names to the nameList.
|
void |
getAllKeyNamesOfIdentity(Name identityName,
ArrayList nameList,
boolean isDefault)
Append all the key names of a particular identity to the nameList.
|
IdentityCertificate |
getCertificate(Name certificateName)
Get a certificate from the identity storage.
|
Name |
getDefaultCertificateNameForKey(Name keyName)
Get the default certificate name for the specified key.
|
static String |
getDefaultFilePath(File filesRoot)
Get the default database file path based on the files root.
|
static String |
getDefaultFilePath(String filesRoot)
Get the default database file path based on the files root.
|
Name |
getDefaultIdentity()
Get the default identity.
|
Name |
getDefaultKeyNameForIdentity(Name identityName)
Get the default key name for the specified identity.
|
Blob |
getKey(Name keyName)
Get the public key DER blob from the identity storage.
|
String |
getTpmLocator()
Get the TPM locator associated with this storage.
|
boolean |
revokeIdentity()
Revoke the identity.
|
void |
setDefaultCertificateNameForKey(Name keyName,
Name certificateName)
Set the default key name for the specified identity.
|
void |
setDefaultIdentity(Name identityName)
Set the default identity.
|
void |
setDefaultKeyNameForIdentity(Name keyName,
Name identityNameCheck)
Set a key as the default key of an identity.
|
protected void |
updateKeyStatus(Name keyName,
boolean isActive)
In table Key, set 'active' to isActive for the keyName.
|
activateKey, checkSetDefaultKeyNameForIdentity, deactivateKeygetDefaultCertificate, getDefaultCertificateNameForIdentity, getNewKeyName, setDefaultKeyNameForIdentitypublic AndroidSqlite3IdentityStorage(String databaseFilePath)
databaseFilePath - The path of the SQLite file.public static String getDefaultFilePath(File filesRoot)
filesRoot - The root file directory. An Android app can use
context.getFilesDir()public static String getDefaultFilePath(String filesRoot)
filesRoot - The root file directory.public final boolean doesIdentityExist(Name identityName) throws SecurityException
doesIdentityExist in class IdentityStorageidentityName - The identity name.SecurityExceptionpublic final void addIdentity(Name identityName) throws SecurityException
addIdentity in class IdentityStorageidentityName - The identity name to be added.SecurityExceptionpublic final boolean revokeIdentity()
revokeIdentity in class IdentityStoragepublic final boolean doesKeyExist(Name keyName) throws SecurityException
doesKeyExist in class IdentityStoragekeyName - The name of the key.SecurityExceptionpublic final void addKey(Name keyName, KeyType keyType, Blob publicKeyDer) throws SecurityException
addKey in class IdentityStoragekeyName - The name of the public key to be added.keyType - Type of the public key to be added.publicKeyDer - A blob of the public key DER to be added.SecurityExceptionpublic final Blob getKey(Name keyName) throws SecurityException
getKey in class IdentityStoragekeyName - The name of the requested public key.SecurityException - if the key doesn't exist.protected void updateKeyStatus(Name keyName, boolean isActive) throws SecurityException
updateKeyStatus in class Sqlite3IdentityStorageBasekeyName - The name of the key.isActive - The value for the 'active' field.SecurityExceptionpublic final boolean doesCertificateExist(Name certificateName) throws SecurityException
doesCertificateExist in class IdentityStoragecertificateName - The name of the certificate.SecurityExceptionpublic final void addCertificate(IdentityCertificate certificate) throws SecurityException
addCertificate in class IdentityStoragecertificate - The certificate to be added. This makes a copy of the
certificate.SecurityExceptionpublic final IdentityCertificate getCertificate(Name certificateName) throws SecurityException
getCertificate in class IdentityStoragecertificateName - The name of the requested certificate.SecurityException - if the certificate doesn't exist.public final String getTpmLocator() throws SecurityException
getTpmLocator in class IdentityStorageSecurityException - if the TPM locator doesn't exist.public final Name getDefaultIdentity() throws SecurityException
getDefaultIdentity in class IdentityStorageSecurityException - if the default identity is not set.public final Name getDefaultKeyNameForIdentity(Name identityName) throws SecurityException
getDefaultKeyNameForIdentity in class IdentityStorageidentityName - The identity name.SecurityException - if the default key name for the identity is not set.public final Name getDefaultCertificateNameForKey(Name keyName) throws SecurityException
getDefaultCertificateNameForKey in class IdentityStoragekeyName - The key name.SecurityException - if the default certificate name for the key name
is not set.public void getAllIdentities(ArrayList nameList, boolean isDefault) throws SecurityException
getAllIdentities in class IdentityStoragenameList - Append result names to nameList.isDefault - If true, add only the default identity name. If false, add
only the non-default identity names.SecurityExceptionpublic void getAllKeyNamesOfIdentity(Name identityName, ArrayList nameList, boolean isDefault) throws SecurityException
getAllKeyNamesOfIdentity in class IdentityStorageidentityName - The identity name to search for.nameList - Append result names to nameList.isDefault - If true, add only the default key name. If false, add only
the non-default key names.SecurityExceptionpublic void getAllCertificateNamesOfKey(Name keyName, ArrayList nameList, boolean isDefault) throws SecurityException
getAllCertificateNamesOfKey in class IdentityStoragekeyName - The key name to search for.nameList - Append result names to nameList.isDefault - If true, add only the default key name. If false, add only
the non-default key names.SecurityExceptionpublic final void setDefaultIdentity(Name identityName) throws SecurityException
setDefaultIdentity in class IdentityStorageidentityName - The default identity name.SecurityExceptionpublic final void setDefaultKeyNameForIdentity(Name keyName, Name identityNameCheck) throws SecurityException
setDefaultKeyNameForIdentity in class IdentityStoragekeyName - The name of the key.identityNameCheck - The identity name to check that the keyName
contains the same identity name. If an empty name, it is ignored.SecurityExceptionpublic final void setDefaultCertificateNameForKey(Name keyName, Name certificateName) throws SecurityException
setDefaultCertificateNameForKey in class IdentityStoragekeyName - The key name.certificateName - The certificate name.SecurityExceptionpublic void deleteCertificateInfo(Name certificateName) throws SecurityException
deleteCertificateInfo in class IdentityStoragecertificateName - The certificate name.SecurityExceptionpublic void deletePublicKeyInfo(Name keyName) throws SecurityException
deletePublicKeyInfo in class IdentityStoragekeyName - The key name.SecurityExceptionpublic void deleteIdentityInfo(Name identityName) throws SecurityException
deleteIdentityInfo in class IdentityStorageidentityName - The identity name.SecurityExceptionCopyright © 2019. All rights reserved.