public interface KeyAccessor
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsAlias(String alias)
Returns true if keystore contains the given alias.
|
X509Certificate |
getCertificate(String alias)
Returns the X509Certificate associated with the given alias.
|
CertificateEntry[] |
getClientAuthenticationCertificateEntries()
Returns the CertificateEntry array containing available client authentication certificates.
|
CertificateEntry[] |
getDocumentSigningCertificateEntries()
Returns the CertificateEntry array containing available signing certificates.
|
KeyStore.Builder |
getKeyStoreBuilder(String alias)
Returns KeyStore.Builder instance for KeyStore containing the given alias.
|
PrivateKey |
getPrivateKey(String alias)
Returns the PrivateKey associated with the given alias.
|
String |
selectClientAuthenticationCertificate()
Requests user to select the client authentication certificate
and returns the alias name of the selected item, or null if action is cancelled.
|
String |
selectDocumentSigningCertificate()
Requests user to select the signing certificate
and returns the alias name of the selected item, or null if action is cancelled.
|
byte[] |
signData(byte[] data,
String alias)
Returns the signature bytes of all the given data.
|
CertificateEntry[] getDocumentSigningCertificateEntries() throws KeyStoreException
Document signing certificates are resolved by the Extended Key Usage extension, containing the "Document signing" object identifier (OID 1.3.6.1.4.1.311.10.3.12).
KeyStoreException - if certificate data cannot be retrieved.CertificateEntry[] getClientAuthenticationCertificateEntries() throws KeyStoreException
Client authentication certificates are resolved by the Extended Key Usage extension, containing the "Client Authentication" object identifier (OID 1.3.6.1.5.5.7.3.2).
KeyStoreException - if certificate data cannot be retrieved.String selectDocumentSigningCertificate() throws KeyStoreException
KeyStoreException - if keystore cannot be accessed.String selectClientAuthenticationCertificate() throws KeyStoreException
KeyStoreException - if keystore cannot be accessed.boolean containsAlias(String alias) throws KeyStoreException
alias - the alias name.KeyStoreException - if keystore cannot be accessed.X509Certificate getCertificate(String alias) throws KeyStoreException
An alias of the certificate can be obtained from the CertificateEntry object
returned by either getDocumentSigningCertificateEntries()
or getClientAuthenticationCertificateEntries() method.
alias - the alias name.KeyStoreException - if certificate data cannot be accessed.PrivateKey getPrivateKey(String alias) throws KeyStoreException
An alias of the key can be obtained from the CertificateEntry object
returned by either getDocumentSigningCertificateEntries()
or getClientAuthenticationCertificateEntries() method.
alias - the alias name.KeyStoreException - if key data cannot be accessed.byte[] signData(byte[] data,
String alias)
throws KeyStoreException,
SignatureException
data - the byte array to use for the signature calculation.alias - the alias name representing a private key of the identity whose signature is going to be generated.
An alias of the key can be obtained from the CertificateEntry object
returned by either getDocumentSigningCertificateEntries()
or getClientAuthenticationCertificateEntries() method.
KeyStoreException - if key data cannot be accessed.SignatureException - if the given data cannot be signed.KeyStore.Builder getKeyStoreBuilder(String alias) throws KeyStoreException
alias - the alias name.KeyStoreException - if KeyStore cannot be accessed.