public interface CertificateManager
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
BIT_LENGTH
The key for the bit length of the key of the certificate that should be issued.
|
static java.lang.String |
COMMON_NAME
The key for the Common Name of the certificate that should be issued
|
static java.lang.String |
COUNTRY_NAME
The key for the Country Name of the certificate that should be issued
|
static java.lang.String |
DIGEST_ALGORITHM
Deprecated.
|
static java.lang.String |
DOMAIN_COMPONENT
The key for the Domain Component of the certificate that should be issued
|
static java.lang.String |
DSA
Constant that is value of
PK_ALGORITHM and stands for DSA public key algorithm |
static java.lang.String |
E_MAIL
The key for the e-mail of the certificate that should be issued
|
static java.lang.String |
ISSUER
The key for the unique name of issuer of the certificate that should be issued
|
static java.lang.String |
LOCALITY_NAME
The key for the Locality Name of the certificate that should be issued
|
static java.lang.String |
MD2
Deprecated.
|
static java.lang.String |
MD5
Deprecated.
|
static java.lang.String |
ORGANIZATION_NAME
The key for the Organization Name of the certificate that should be issued
|
static java.lang.String |
ORGANIZATION_UNIT_NAME
The key for the Organization Unit Name of the certificate that should be issued
|
static java.lang.String |
PASSWORD_FOR_KPH
The key for the password for password protected key pair holders.
|
static java.lang.String |
PK_ALGORITHM
The key for the public key algorithm of the key of the certificate that should be issued
|
static java.lang.String |
RSA
Constant that is value of
PK_ALGORITHM and stands for RSA public key algorithm |
static java.lang.String |
SEC_CTX_CERTIFICATE
The key for the certificate name the key pair holder should represent.
|
static java.lang.String |
SERIAL_NUMBER
The key for the serial number of the certificate that should be issued
|
static java.lang.String |
SHA1
Deprecated.
|
static java.lang.String |
SIGNATURE_ALGORITHM
The key for the signature algorithm that should be used when issue certificate.
|
static java.lang.String |
STATE_OR_PROVINCE_NAME
The key for the State Or Province Name of the certificate that should be issued
|
static java.lang.String |
STREET
The key for the Street Name of the certificate that should be issued
|
static java.lang.String |
UID
The key for the UID of the certificate that should be issued
|
static java.lang.String |
VALID_NOT_AFTER
The key for the end validity date of the certificate that should be issued
|
static java.lang.String |
VALID_NOT_BEFORE
The key for the start validity date of the certificate that should be issued
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
addCertificate(Certificate certificate)
Adds a certificate to the Certificate Repository with certain properties.
|
void |
addCertificateListener(CertificateListener listener)
Adds certificate listener that will be notified for changes into the Certificate Repository.
|
void |
addDomain(java.lang.String domain)
Adds a new domain into the Certificate Repository.
|
java.lang.String |
createCertificate(java.util.Dictionary keyAndCertificateProps)
Creates key pair and certificate with given key properties and adds it into the Certificate Repository.
|
java.io.InputStream |
createSecurityCtx(java.util.Dictionary keyProps,
java.lang.String[] trustedCertificatesUniqueNames,
java.lang.String password,
java.lang.String provider,
java.lang.String type,
java.util.Properties kshRegProps,
java.util.Properties kmRegProps,
java.util.Properties tmRegProps,
boolean async)
Create security context.
|
java.io.InputStream |
exportKeyStore(java.lang.String[] certificateUniqueNames,
boolean includeKeyPairs,
java.lang.String password,
java.lang.String keyPassword,
java.lang.String provider,
java.lang.String type,
boolean asynchronious)
Imports a key store into specified groups, and domain.
|
Certificate |
getCertificate(java.lang.String uniqueName)
Gets an existing Certificate from the Certificate Repository.
|
Enumerator |
getCertificates(java.lang.String domain,
java.lang.String group)
Returns an
Enumerator containing certificates unique names from the Certificate Repository that are
into specified domain and into the group. |
java.lang.String |
getCertificateUniqueName(byte[] certificate)
Gets certificate unique name by specified certificate material.
|
java.lang.String[] |
getDomains()
Returns array of all certificate domains the Certificate Repository has certificates in.
|
java.lang.String[] |
getGroups()
Returns the certificate groups in the Certificate Repository.
|
java.lang.String |
getIssuerCertificate(byte[] subjectCertificate,
java.lang.String domain,
java.lang.String group)
Returns uniqueName of the issuer of this certificate into certain domain.
|
Enumerator |
getOwnCertificates(java.lang.String domain,
java.lang.String group)
Returns an
Enumerator containing certificates unique names from the Certificate Repository that are
into specified domain, into the group AND have private keys (i.e. |
java.util.Dictionary |
getProperties(java.lang.String uniqueName)
Returns properties for a certificate with passed unique name.
|
Enumerator |
getTrustedCertificates(java.lang.String domain,
java.lang.String group)
Returns an
Enumerator containing certificates unique names from the Certificate Repository that are
into specified domain, into the group AND have NOT private keys (i.e. |
void |
importKeyStore(java.io.InputStream is,
java.lang.String group,
java.lang.String[] domain,
java.lang.String password,
java.lang.String keyPassword,
java.lang.String provider,
java.lang.String type)
Imports a key store into specified grops, and domain.
|
boolean |
isExpired(java.lang.String uniqueName,
java.util.Date date)
Check a certificate of it is expired just by its unique name.
|
Certificate |
openCertificate(byte[] certificate)
Utility method that packs a certificate into a user friendly shell.
|
void |
removeCertificate(java.lang.String uniqueName)
Deletes a certificate from the Certificate Repository if it is removable.
|
void |
removeCertificateListener(CertificateListener listener)
Removes previously added certificate listener form listeners.
|
void |
removeDomain(java.lang.String domain)
Removes a domain from the Certificate Repository.
|
void |
removeExpiredCertificates(java.util.Date date)
Removes certificates form the Certificate Repository that are expired / will expire before the
expiration date. |
static final java.lang.String RSA
PK_ALGORITHM and stands for RSA public key algorithmstatic final java.lang.String DSA
PK_ALGORITHM and stands for DSA public key algorithmstatic final java.lang.String ISSUER
static final java.lang.String PK_ALGORITHM
static final java.lang.String BIT_LENGTH
static final java.lang.String SERIAL_NUMBER
static final java.lang.String SIGNATURE_ALGORITHM
static final java.lang.String VALID_NOT_BEFORE
static final java.lang.String VALID_NOT_AFTER
static final java.lang.String COMMON_NAME
static final java.lang.String LOCALITY_NAME
static final java.lang.String STATE_OR_PROVINCE_NAME
static final java.lang.String ORGANIZATION_NAME
static final java.lang.String ORGANIZATION_UNIT_NAME
static final java.lang.String COUNTRY_NAME
static final java.lang.String STREET
static final java.lang.String DOMAIN_COMPONENT
static final java.lang.String UID
static final java.lang.String E_MAIL
static final java.lang.String DIGEST_ALGORITHM
static final java.lang.String MD2
static final java.lang.String MD5
static final java.lang.String SHA1
static final java.lang.String PASSWORD_FOR_KPH
static final java.lang.String SEC_CTX_CERTIFICATE
Certificate openCertificate(byte[] certificate) throws ManagementException
Certificate.getUniqueName()
will return null.certificate - byte array certificate form.ManagementException - if an exception occurs.java.lang.String getCertificateUniqueName(byte[] certificate)
throws ManagementException
certificate - certificate materialnullManagementException - is thrown if an error has occurred while modifying the Certificate Repository.java.lang.String addCertificate(Certificate certificate) throws ManagementException
Permission - Certificates - Admin to call this method.certificate - Certificate certificate that to be added. Certificate can be obtained using method CertificateManager.openCertificate(byte[])getCertificate(String uniqueName)ManagementException - is thrown if an error has occurred while modifying the Certificate Repository or the logged user does not imply the proper role.Certificate getCertificate(java.lang.String uniqueName) throws ManagementException
Permission - Certificates - Monitor to call this method.uniqueName - the certificate's handler. It is unique into the Certificate Repository scope.ManagementException - is thrown if an error has occurred while retrieving data from Certificate Repository, certificate is not found into the Certificate Repository or the logged user does not imply the proper role.void removeCertificate(java.lang.String uniqueName)
throws ManagementException
Permission - Certificates - Admin in order to call this method.uniqueName - the unique name of the certificate that is to be removed.ManagementException - is thrown if an error has occurred while modifying the Certificate Repository, trying to remove imported LDAP certificate (a not removable certificate) or the logged user does not imply the proper role.void removeExpiredCertificates(java.util.Date date)
throws ManagementException
expiration date.
The logged user must imply the role Permission - Certificates - Admin to call this method.date - the expiration date the certificates are checked for expiration against.ManagementException - is thrown if an error has occurred while modifying the Certificate Repository or the logged user does not imply the proper role.java.lang.String[] getGroups()
throws ManagementException
ManagementExceptionjava.lang.String[] getDomains()
throws ManagementException
Permission - Certificates - Monitor to call this method.ManagementException - is thrown if an error has occurred while retrieving data from the Certificate Repository or the logged user does not imply the proper role.void addDomain(java.lang.String domain)
throws ManagementException
Permission - Certificates - Admin to call this method.domain - domain nameManagementException - is thrown if domain already exists or an error has occurred while retrieving data from the Certificate Repository or the logged user does not imply the proper role.void removeDomain(java.lang.String domain)
throws ManagementException
Permission - Certificates - Admin to call this method.domain - domain nameManagementException - is thrown if an error has occurred while retrieving data from the Certificate Repository or the logged user does not imply the proper role.Enumerator getCertificates(java.lang.String domain, java.lang.String group) throws ManagementException
Enumerator containing certificates unique names from the Certificate Repository that are
into specified domain and into the group. If there have not any, returns null. This method can be used for
listing certificates by filter.(null, null)("A", null)(null, "B")Permission - Certificates - Monitor to call this method.domain - a certificate must belongs to domain in order to be included into result. Passing domain null means that
certificate in result may belongs to any domain (or may not belongs to any domain) - no domain restriction to the result will be applied.group - the group the certificates in result should belong. null means that certificate in the result can belongs
to any groups.Enumerator is
String.If no certificates are found, then null is returned.ManagementException - is thrown if an error has occurred while retrieving data from the Certificate Repository or the logged user does not imply the proper role.Enumerator getOwnCertificates(java.lang.String domain, java.lang.String group) throws ManagementException
Enumerator containing certificates unique names from the Certificate Repository that are
into specified domain, into the group AND have private keys (i.e. belongs to mPRM). If there have not any, returns null.
This method can be used for listing certificates by filter.(null, null)("A", null)(null, "B")Permission - Certificates - Monitor to call this method. Note that nevertheless
a user with Permission - Certificates - Monitor can obtain unique id of a certificate with private key, and
can obtain X509Certificate instance, it can not obtain private key from certificate without having Permission - Certificates - Admin role.domain - a certificate must belongs to domain in order to be included into result. Passing domain null means that
certificate in result may belongs to any domain (or may not belongs to any domain) - no domain restriction to the result will be applied.group - the group the certificates in result should belong. null means that certificate in the result can belongs
to any groups.Enumerator is
String. If no certificates are found, then null is returned.ManagementException - is thrown if an error has occurred while retrieving data from the Certificate Repository or the logged user does not imply the proper role.Enumerator getTrustedCertificates(java.lang.String domain, java.lang.String group) throws ManagementException
Enumerator containing certificates unique names from the Certificate Repository that are
into specified domain, into the group AND have NOT private keys (i.e. does not belongs to mPRM). If there have not any, returns null.
This method can be used for listing certificates by filter.(null, null)("A", null)(null, "B")Permission - Certificates - Monitor to call this method. Note that nevertheless
a user with Permission - Certificates - Monitor can obtain unique id of a certificate with private key, and
can obtain X509Certificate instance, it can not obtain private key from certificate without having Permission - Certificates - Admin role.domain - a certificate must belongs to domain in order to be included into result. Passing domain null means that
certificate in result may belongs to any domain (or may not belongs to any domain) - no domain restriction to the result will be applied.group - the group the certificates in result should belong. null means that certificate in the result can belongs
to any groups.Enumerator is
String. If no certificates are found, then null is returned.ManagementException - is thrown if an error has occurred while retrieving data from the Certificate Repository or the logged user does not imply the proper role.java.lang.String getIssuerCertificate(byte[] subjectCertificate,
java.lang.String domain,
java.lang.String group)
throws ManagementException
null subject certificate may be assumed as trusted for this domain if it has not
expired (this method doesn't provide expiration checking) and if the returned issuer certificate has not expired.
The logged user must imply the role Permission - Certificates - Monitor to call this method.subjectCertificate - byte array representation of the subject certificate.domain - the domain the issuer certificate is searched into. If null the issuer is searched into all certificates.group - the group the certificates in result should belong. null means that certificate in the result can belongs
to any groups.null.ManagementException - if an exception occurs or the logged user does not imply the proper role.boolean isExpired(java.lang.String uniqueName,
java.util.Date date)
throws ManagementException
getIssuerCertificate(Certificate subjectCertificate, String domain) and one want to check its expiration status
for certain time without creating an instance of it.
The logged user must imply the role Permission - Certificates - Monitor to call this method.uniqueName - unique name of certificate that should be checked for expiration.date - the date certificate expiration should be checking against.ManagementException - if an exception occurs, certificate is not found into the Certificate Repository or the logged user does not imply the proper role.java.util.Dictionary getProperties(java.lang.String uniqueName)
throws ManagementException
Permission - Certificates - Monitor to call this method.uniqueName - the unique name of the certificate.ManagementException - if an exception occurs, certificate is not found into the Certificate Repository or the logged user does not imply the proper role.void importKeyStore(java.io.InputStream is,
java.lang.String group,
java.lang.String[] domain,
java.lang.String password,
java.lang.String keyPassword,
java.lang.String provider,
java.lang.String type)
throws ManagementException
Permission - Certificates - Admin to call this method.
Note: Sun JDK 1.4.2_05+ provides SunJSSA provider which registers PKCS12 keystore. This one can be used for
import export actions.is - input stream that contains the key store. It should be in format proper to be loaded with KeyStore.load() method of the
provider specified with provider and type.group - the group the certificates should be imported to. If null the certificates are imported to GENERAL_GROUP.domain - the domain that the imported certificates should be applied to.password - password for decrypting the key store.keyPassword - password for decrypting the keys of store.provider - key store provider.type - type key store type.ManagementException - if an exception occurs, certificate is not found into the Certificate Repository, the logged user does not imply the proper role or the provider does not exists or does not support the type.java.io.InputStream exportKeyStore(java.lang.String[] certificateUniqueNames,
boolean includeKeyPairs,
java.lang.String password,
java.lang.String keyPassword,
java.lang.String provider,
java.lang.String type,
boolean asynchronious)
throws ManagementException
Permission - Certificates - Admin to call this method with includeKeyPairs = true and
Permission - Certificates - Monitor with false.certificateUniqueNames - the unique names of the certificates to be exported.includeKeyPairs - if the exported key store should contains key pairs (for certificates that have such) or not (to contain only certificates).password - password for encrypting the key store.keyPassword - password for encrypting the keys of store.provider - key store provider.type - type key store type.asynchronious - if to execute action asynchronously with method call and to fill the input stream result asynchronously
(the returned input stream may continue to receive data after it is returned by the method)
with the method execution or to execute action synchronously and to return filled input stream.
The asynchronous execution may gain better performance but may hide exceptions.KeyStore.load() method of the
provider specified with provider and type.ManagementException - if an exception occurs, certificate is not found into the Certificate Repository, the logged user does not imply the proper role or the provider does not exists or does not support the requested type.java.io.InputStream createSecurityCtx(java.util.Dictionary keyProps,
java.lang.String[] trustedCertificatesUniqueNames,
java.lang.String password,
java.lang.String provider,
java.lang.String type,
java.util.Properties kshRegProps,
java.util.Properties kmRegProps,
java.util.Properties tmRegProps,
boolean async)
throws ManagementException
kshRegProps == null and kmRegProps == null and
tsRegProps == null or a bundle that may be installed on an OSGi framework that contains credentials and registers
the services it is configured to register.keyProps - the properties used for creation of the security context.trustedCertificatesUniqueNames - the unique names of certificates from the Certificate Repository that should be trusted. May be nullpassword - the password for keystore protection.provider - the keystore provider.type - the keystore type.kshRegProps - if not null a com.prosyst.mprm.util.keystore.osgi.KeyStoreHolder service with these registration properties will be registered.kmRegProps - if not null a javax.security.ssl.X509KeyManager service with these registration properties will be registered.tmRegProps - if not null a javax.security.ssl.X509TrustManager service with these registration properties will be registered.async - ManagementExceptionjava.lang.String createCertificate(java.util.Dictionary keyAndCertificateProps)
throws ManagementException
CertificateManager.ISSUER property key) then the certificate is
signed by the specified issuer, otherwise a selfsigned certificate is created. The property CertificateManager.BIT_LENGTH value must be the
string representation of the length or java.lang.Integer.
The values of properties CertificateManager.VALID_NOT_BEFORE and CertificateManager.VALID_NOT_BEFORE
must the long equivalents of the date (Date.getTime()) (encoded as string or java.lang.Long) or java.util.Date.
The value of CertificateManager.SERIAL_NUMBER must be a java.math.BigInteger keyAndCertificateProps - properties for private key and certificate creation.ManagementExceptionvoid addCertificateListener(CertificateListener listener) throws ManagementException
Permission - Certificates - Monitor to call this method.listener - certificate listener to be added.ManagementException - if an exception occurs, certificate is not found into the Certificate Repository or the logged user does not imply the proper role.void removeCertificateListener(CertificateListener listener)
listener - listener to be removed.Copyright © 2019 Bosch Software Innovations GmbH. All Rights Reserved.