|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.nhindirect.stagent.CryptoExtensions
public class CryptoExtensions
Utility functions for searching for certificates.
| Constructor Summary | |
|---|---|
CryptoExtensions()
|
|
| Method Summary | |
|---|---|
static boolean |
certSubjectContainsName(X509Certificate cert,
String name)
Checks if a name is contained in a certificate's DN or alt subjects. |
static boolean |
containsEmailAddressInSubjectAltName(X509Certificate cert,
String subjectName)
Deprecated. As of 1.1.5. Use certSubjectContainsName(X509Certificate, String) |
static X509Certificate |
findCertByName(Collection<X509Certificate> certs,
String name)
Searches a collection of X509Certificates for a certificate that matches the provided name. |
static SignerCertPair |
findSignerByCert(org.bouncycastle.cms.CMSSignedData signedData,
X509Certificate searchCert)
Searches CMS signed data for a specific X509 certificate. |
static Collection<SignerCertPair> |
findSignersByName(org.bouncycastle.cms.CMSSignedData signedData,
String name,
Collection<String> excludeNames)
Searches CMS signed data for a given email name. |
static String |
getJCEProviderName()
Gets the configured JCE crypto provider string for crypto operations. |
static String |
getJCEProviderNameForTypeAndAlgorithm(String type,
String algorithm)
Gets the configured JCE crypto provider that supports the combination of the requested type and algorithm. |
static String |
getSubjectAddress(X509Certificate certificate)
Gets the address name associated with the certificate. |
static boolean |
isEqualThumbprint(X509Certificate cert1,
X509Certificate cert2)
Compares the thumbprints of two certificates for equality. |
static boolean |
matchName(X509Certificate cert,
String name)
Deprecated. As of 1.1.5. Use certSubjectContainsName(X509Certificate, String) |
static void |
registerJCEProviders()
Typically JCE providers are registered through JVM properties files or statically calling Security.addProvider(Provider). |
static void |
setJCEProviderName(String name)
Overrides the configured JCE crypto provider string. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CryptoExtensions()
| Method Detail |
|---|
public static void registerJCEProviders()
Security.addProvider(Provider). The method
allows for configuration of JCE Providers through the OptionsManager classes. This method iterates through a comma delimited set of providers,
dynamically loads the provider class, and and registered each one if it has not already been registered.
If a provider is not configured via the OptionsManager, then the default BouncyCastle provider is registered (if it has not been
already registered).
jceProviderClasses - Comma delimited list of the fully qualified class name of the JCE provider.public static String getJCEProviderName()
public static String getJCEProviderNameForTypeAndAlgorithm(String type,
String algorithm)
type - The crypto type such as CertStore or CertPathValidatoralgorithm - The algorithm such as PKIX or MAC.
public static void setJCEProviderName(String name)
The provider name may be a comma delimited list of provider strings. The first string in the list will be the default provider string
and returned when using getJCEProviderName(); however, the getJCEProviderNameForTypeAndAlgorithm(String, String) will search
through the provider string until a valid provider that supports the requested type and algorithm is found. In this case, the first matching
provider string will be used.
name - The name of the JCE provider.
public static boolean isEqualThumbprint(X509Certificate cert1,
X509Certificate cert2)
thumbprints of two certificates for equality.
cert1 - The first certificate to compare.cert2 - The second certificate to compare.
public static boolean containsEmailAddressInSubjectAltName(X509Certificate cert,
String subjectName)
certSubjectContainsName(X509Certificate, String)
cert - The certificate to check.subjectName - The subject name to check in the alternate names.
public static boolean certSubjectContainsName(X509Certificate cert,
String name)
cert - The certificate to check.name - The name to search for in the certificate.
public static boolean matchName(X509Certificate cert,
String name)
certSubjectContainsName(X509Certificate, String)
cert - The certificate to check for the common name.name - The common name to check for. This method automatically prefixes the name with "CN="
public static Collection<SignerCertPair> findSignersByName(org.bouncycastle.cms.CMSSignedData signedData,
String name,
Collection<String> excludeNames)
signedData - The signed data to search.name - The name to search for in the list of signers.excludeNames - A list of names to exclude from the list. Because the search uses a simple "contains" search, it is possible for the name parameter
to be a substring of what is requested. The excludeNames contains a super string of the name to remove unwanted names from the returned list. This parameter
may be null;
public static X509Certificate findCertByName(Collection<X509Certificate> certs,
String name)
certs - The collection of certificates to search.name - The name to search for in the collection.
public static SignerCertPair findSignerByCert(org.bouncycastle.cms.CMSSignedData signedData,
X509Certificate searchCert)
signedData - The signed data to search.name - The certificate to search for in the signed data.
public static String getSubjectAddress(X509Certificate certificate)
certificate - The certificate to search
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||