Adapted from the CDC Standard Provider's JCA class, this class provides the facilities to look up signature algorithm OIDs from digest and encryption algorithms, and vice versa. More...
Static Public Member Functions | |
static String | getSignatureAlgorithmOID (String digestAlg, String cipherAlg) |
Map from a digest algorithm name and a cipher algorithm name to an OID. | |
static String | getSignatureAlgorithm (String digestAlg, String cipherAlg) |
Map from a digest algorithm name and a cipher algorithm to a signature algorithm name. | |
static String | signatureAlgorithmToCipher (String signatureAlgorithm) |
Map from a signature algorithm to a cipher. | |
static String | signatureAlgorithmToDigest (String signatureAlgorithm) |
Map from a signature algorithm to a digest. | |
static String | getCipherOID (String cipherAlgorithm) |
Get the OID for a cipher algorithm. | |
static String | getDigestOID (String digestAlgorithm) |
Return the preferred OID for a digest algorithm. | |
static String | getSignatureOID (String algorithm) |
Return the preferred OID for a signature algorithm. | |
static String | getSignatureName (String oid) |
Return the preferred name for a signature OID. | |
static String | getDigestName (String oid) |
Return the preferred name for a digest OID. | |
static String | getCipherName (String oid) |
Return the preferred name for a cipher OID. | |
static String[] | signatureAlgorithmToDigestAndCipher (String signatureAlgorithm) |
Parse a DigestwithCipher name into its digest and cipher components. | |
static String | getSignatureAlgorithmFromOIDs (String doid, String coid) |
This method maps a given digest algorithm OID and cipher algorithm OID onto the standard name of the combined signature algorithm. | |
static String | resolveCipherAlias (String alias) |
For specific types, attempts to see if the current name passed in is the canonical name. | |
static String | resolveDigestAlias (String alias) |
static String | resolveSignatureAlias (String alias) |
static String | resolveAlias (String engine, String alias) |
Resolves the given alias to the standard JCA name for the given engine type. | |
static boolean | mapContainsKey (Map<?,?> map, Object key) |
Map accessors that handle synchronization. | |
static< T1, T2 > T2 | mapGet (Map< T1, T2 > map, T1 key) |
static< T1, T2 > void | mapPut (Map< T1, T2 > map, T1 key, T2 value) |
static String | reverseLookup (Map< String, String > e2oid, Map< String, String > oid2e, String alias) |
static AlgorithmParameters | getParametersFromKey (Key key) throws NoSuchAlgorithmException, InvalidParameterSpecException |
Unfortunately, there's no easy way to do this. | |
static AlgorithmParameters | getParamsFromKey (RSAKey rsakey) |
static void | listLoadedProviders () |
Prints the list of loaded providers. | |
static void | listLoadedAliases () |
Prints the list of loaded aliases. | |
Static Protected Attributes | |
static Map< String, Map < String, String > > | _aliasMap |
Map from provider name to provider alias map. | |
Static Package Functions | |
[static initializer] | |
Preload the maps. | |
Static Package Attributes | |
static final boolean | debug = true |
Adapted from the CDC Standard Provider's JCA class, this class provides the facilities to look up signature algorithm OIDs from digest and encryption algorithms, and vice versa.
We start by preloading a lookup table with the standard algorithms, and then attempt to screen-scrape any new ones added by providers from their property lists.
static String org.ccnx.ccn.impl.security.crypto.util.OIDLookup.getCipherOID | ( | String | cipherAlgorithm | ) | [static] |
Get the OID for a cipher algorithm.
This only works for ciphers used in signatures.
cipherAlgorithm | the cipher algorithm. |
static String org.ccnx.ccn.impl.security.crypto.util.OIDLookup.getDigestOID | ( | String | digestAlgorithm | ) | [static] |
Return the preferred OID for a digest algorithm.
digestAlgorithm | the digest algorithm. |
static AlgorithmParameters org.ccnx.ccn.impl.security.crypto.util.OIDLookup.getParametersFromKey | ( | Key | key | ) | throws NoSuchAlgorithmException, InvalidParameterSpecException [static] |
Unfortunately, there's no easy way to do this.
Need to add a way to get parameters from each new key type. Makes it hard to add new key types dynamically. The parameter interfaces should be cleaned up in Java. So instead, we try reflection...
static String org.ccnx.ccn.impl.security.crypto.util.OIDLookup.getSignatureAlgorithm | ( | String | digestAlg, | |
String | cipherAlg | |||
) | [static] |
Map from a digest algorithm name and a cipher algorithm to a signature algorithm name.
If the signature algorithm name doesn't exist, return null.
digestAlg | the digest algorithm. | |
cipherAlg | the cipher algorithm. |
static String org.ccnx.ccn.impl.security.crypto.util.OIDLookup.getSignatureAlgorithmFromOIDs | ( | String | doid, | |
String | coid | |||
) | [static] |
This method maps a given digest algorithm OID and cipher algorithm OID onto the standard name of the combined signature algorithm.
For this to work the aliases must be well defined such as described below:
The oid denotes the sequence of OID numbers separated by dots but without a leading "OID.". In some cases, such as the DSA, there is no cipher engine corresponding to oid2. In this case, oid2 must be mapped to the corresponding name by other engine types, such as a KeyFactory.
All found mappings are cached for future use, as well as the reverse mapping, which is much more complicated to synthesise.
doid | The string representation of the digest algorithm OID. The OID must have a "OID." prefix. | |
coid | The string representation of the cipher algorithm OID. The OID must have a "OID." prefix. |
null
if no mapping could be found. static String org.ccnx.ccn.impl.security.crypto.util.OIDLookup.getSignatureAlgorithmOID | ( | String | digestAlg, | |
String | cipherAlg | |||
) | [static] |
Map from a digest algorithm name and a cipher algorithm name to an OID.
digestAlg | the digest algorithm. | |
cipherAlg | the cipher algorithm. |
static boolean org.ccnx.ccn.impl.security.crypto.util.OIDLookup.mapContainsKey | ( | Map<?,?> | map, | |
Object | key | |||
) | [static] |
Map accessors that handle synchronization.
TODO replace with read-only maps, and make these go away after initialization. (Can also use Collection.synchronizedMap).
static String org.ccnx.ccn.impl.security.crypto.util.OIDLookup.resolveAlias | ( | String | engine, | |
String | alias | |||
) | [static] |
Resolves the given alias to the standard JCA name for the given engine type.
If no appropriate mapping is defined then null
is returned. If the given alias is actually an OID string and there is an appropriate alias mapping defined for that OID by some provider then the corresponding JCA name is returned.
engine | The JCA engine type name. | |
alias | The alias to resolve for the given engine type. |
null
if no appropriate mapping could be found. static String org.ccnx.ccn.impl.security.crypto.util.OIDLookup.resolveCipherAlias | ( | String | alias | ) | [static] |
For specific types, attempts to see if the current name passed in is the canonical name.
If not passes problem to resolveAlias.
static String org.ccnx.ccn.impl.security.crypto.util.OIDLookup.signatureAlgorithmToCipher | ( | String | signatureAlgorithm | ) | [static] |
Map from a signature algorithm to a cipher.
signatureAlgorithm | the signature algorithm. |
static String org.ccnx.ccn.impl.security.crypto.util.OIDLookup.signatureAlgorithmToDigest | ( | String | signatureAlgorithm | ) | [static] |
Map from a signature algorithm to a digest.
signatureAlgorithm | the signature algorithm. |
static String [] org.ccnx.ccn.impl.security.crypto.util.OIDLookup.signatureAlgorithmToDigestAndCipher | ( | String | signatureAlgorithm | ) | [static] |
Parse a DigestwithCipher name into its digest and cipher components.
Attempt to cope with aliases, etc.