public class CMSUtils
extends java.lang.Object
| Constructor and Description |
|---|
CMSUtils() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
addPadding(java.lang.String algoName) |
static boolean |
checkKeyParity(javax.crypto.SecretKey key,
int parity)
Check the least significant bit of each key byte for the parity
indicated --
1 for odd parity or 0 for
even parity. |
static X509 |
convertX509(java.security.cert.X509Certificate cert)
Converts an X509Certificate object to an X509 object
|
static byte[] |
generateKeyID(java.security.PublicKey key) |
static byte[] |
generateSPKI160(java.security.cert.X509Certificate cert)
Generates a 160 bit Subject Key Identifier as per RFC-2459.
|
static byte[] |
generateSPKI64(java.security.cert.X509Certificate cert)
Generates a 64 bit Subject Key Identifier as per RFC-2459.
|
static AlgorithmIdentifier |
getAlgoID(java.lang.String name)
Algoname to algoId mapping
|
static java.lang.String |
getAlgoName(AlgorithmIdentifier oid)
Algoid to algoname mapping
|
static java.lang.String |
getAlgoName(AlgorithmIdentifier oid,
boolean removeMode)
Algoid to algoname mapping
|
static java.lang.String |
getSigAlgName(java.lang.String encId,
java.lang.String digId) |
static void |
setKeyParity(javax.crypto.SecretKey key,
int parity)
Set the least significant bit of each key byte so that it has the parity
indicated --
1 for odd parity or 0 for
even parity. |
static java.util.Vector |
toJCECertVector(java.util.Vector certs) |
static java.security.PublicKey |
toJCEPublicKey(oracle.security.crypto.core.PublicKey phaoskey) |
static java.security.cert.X509Certificate |
toX509JCECertificate(X509 cert) |
static java.util.Vector |
toX509Vector(java.util.Vector certs)
Converts a Vector of X509Certificate Objects to a Vector of X509 objects
|
public static byte[] generateSPKI64(java.security.cert.X509Certificate cert)
throws java.security.NoSuchAlgorithmException
cert - The public key X509 certificate.java.security.NoSuchAlgorithmExceptionpublic static byte[] generateSPKI160(java.security.cert.X509Certificate cert)
throws java.security.NoSuchAlgorithmException
cert - The public key X509 certificate.java.security.NoSuchAlgorithmExceptionpublic static AlgorithmIdentifier getAlgoID(java.lang.String name)
throws java.security.NoSuchAlgorithmException
name - Name of the algorithmjava.security.NoSuchAlgorithmExceptionpublic static java.lang.String getAlgoName(AlgorithmIdentifier oid)
throws java.security.NoSuchAlgorithmException
oid - Algorithmidentifier for which algorithm name is requiredjava.security.NoSuchAlgorithmExceptionpublic static java.lang.String getAlgoName(AlgorithmIdentifier oid,
boolean removeMode)
throws java.security.NoSuchAlgorithmException
oid - Algorithmidentifier for which algorithm name is requiredremoveMode - is set to true in case the mode in the algoname needs to be removed
for instance while creating an instance of KeyGeneratorjava.security.NoSuchAlgorithmExceptionpublic static byte[] generateKeyID(java.security.PublicKey key)
throws java.security.NoSuchAlgorithmException
java.security.NoSuchAlgorithmExceptionpublic static void setKeyParity(javax.crypto.SecretKey key,
int parity)
1 for odd parity or 0 for
even parity. This applies primarily to DES and DES-EDE keys.key - The key for which parity is to be set.parity - 1 for odd parity or 0 for even parity.public static boolean checkKeyParity(javax.crypto.SecretKey key,
int parity)
1 for odd parity or 0 for
even parity. This applies primarily to DES and DES-EDE keys.key - The key for which parity is to be set.parity - 1 for odd parity or 0 for even parity.true if each byte has the specified parity
otherwise falsepublic static java.lang.String getSigAlgName(java.lang.String encId,
java.lang.String digId)
public static java.lang.String addPadding(java.lang.String algoName)
algoName - public static X509 convertX509(java.security.cert.X509Certificate cert) throws java.security.cert.CertificateEncodingException
cert - X509Certificate objectjava.security.cert.CertificateEncodingExceptionpublic static java.util.Vector toX509Vector(java.util.Vector certs)
throws java.security.cert.CertificateEncodingException
java.security.cert.CertificateEncodingExceptionpublic static java.util.Vector toJCECertVector(java.util.Vector certs)
throws java.security.cert.CertificateException
java.security.cert.CertificateExceptionpublic static java.security.cert.X509Certificate toX509JCECertificate(X509 cert) throws java.security.cert.CertificateException
java.security.cert.CertificateExceptionpublic static java.security.PublicKey toJCEPublicKey(oracle.security.crypto.core.PublicKey phaoskey)
throws java.security.NoSuchAlgorithmException,
java.security.spec.InvalidKeySpecException
java.security.NoSuchAlgorithmExceptionjava.security.spec.InvalidKeySpecException