com.ibm.security.pkcs7
Class PKCS7

java.lang.Object
  |
  +--com.ibm.security.pkcs7.PKCS7

public final class PKCS7
extends Object

PKCS #7 helper class. This class defines static fields and provides helper class methods for the PKCS7 package.


Constructor Summary
PKCS7()
          Create a PKCS7 object with default values.
PKCS7(String provider)
          Create a PKCS7 object with default values.
 
Method Summary
static String getDigestAlgorithm(AlgorithmId alg)
          Return the message digest AlgorithmId object for the specified message digest and signature AlgorithmId.
static String getDigestAlgorithm(AlgorithmId alg, String provider)
          Return the message digest AlgorithmId object for the specified message digest and signature AlgorithmId.
static String getDigestAlgorithm(String digestSignatureAlgorithm)
          Return the message digest AlgorithmId object for the specified message digest and signature algorithm.
static String getDigestAlgorithm(String digestSignatureAlgorithm, String provider)
          Return the message digest AlgorithmId object for the specified message digest and signature algorithm.
static String getDigestSignatureAlgorithm(AlgorithmId digestAlg, AlgorithmId signatureAlg)
          Combine the message digest and signature algorithms and return a combined AlgorithmId representing the message digest and signature algorithm.
static String getDigestSignatureAlgorithm(AlgorithmId digestAlg, AlgorithmId signatureAlg, String provider)
          Combine the message digest and signature algorithms and return a combined AlgorithmId representing the message digest and signature algorithm.
static String getDigestSignatureAlgorithm(String digestAlgorithm, String signatureAlgorithm)
          Combine the message digest and signature algorithms and return a combined AlgorithmId representing the message digest and signature algorithm.
static String getDigestSignatureAlgorithm(String digestAlgorithm, String signatureAlgorithm, String provider)
           
static String getMACAlgorithm(AlgorithmId alg)
          Return the MAC AlgorithmId object for the specified MAC AlgorithmId.
static String getMACAlgorithm(String macAlgorithm)
          Return the MAC AlgorithmId object for the specified MAC algorithm.
static String getSignatureAlgorithm(AlgorithmId alg)
          Return the signature AlgorithmId object for the specified message digest and signature AlgorithmId.
static String getSignatureAlgorithm(String digestSignatureAlgorithm)
          Return the signature AlgorithmId object for the specified message digest and signature algorithm.
static boolean isData(ObjectIdentifier oid)
          Return true if the ObjectIdentifier matches the Data ObjectIdentifer.
static boolean isData(String oidString)
          Return true if the string matches the Data ObjectIdentifer.
static boolean isDigestedData(ObjectIdentifier oid)
          Return true if the ObjectIdentifier matches the DigestedData ObjectIdentifer.
static boolean isDigestedData(String oidString)
          Return true if the string matches the DigestedData ObjectIdentifer.
static boolean isEncryptedData(ObjectIdentifier oid)
          Return true if the ObjectIdentifier matches the EncryptedData ObjectIdentifer.
static boolean isEncryptedData(String oidString)
          Return true if the string matches the EncryptedData ObjectIdentifer.
static boolean isEnvelopedData(ObjectIdentifier oid)
          Return true if the ObjectIdentifier matches the EnvelopedData ObjectIdentifer.
static boolean isEnvelopedData(String oidString)
          Return true if the string matches the EnvelopedData ObjectIdentifer.
static boolean isNetscapeCertSequence(ObjectIdentifier oid)
          Return true if the ObjectIdentifier matches the NetscapeCertSequence ObjectIdentifer.
static boolean isNetscapeCertSequence(String oidString)
          Return true if the string matches the NetscapeCertSequence ObjectIdentifer.
static boolean isSignedAndEnvelopedData(ObjectIdentifier oid)
          Return true if the ObjectIdentifier matches the SignedAndEnvelopedData ObjectIdentifer.
static boolean isSignedAndEnvelopedData(String oidString)
          Return true if the string matches the SignedAndEnvelopedData ObjectIdentifer.
static boolean isSignedData(ObjectIdentifier oid)
          Return true if the ObjectIdentifier matches the SignedData ObjectIdentifer.
static boolean isSignedData(String oidString)
          Return true if the string matches the SignedData ObjectIdentifer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PKCS7

public PKCS7()
Create a PKCS7 object with default values.

PKCS7

public PKCS7(String provider)
Create a PKCS7 object with default values.
Parameters:
provider - the name of the java security provider to use
Method Detail

isData

public static boolean isData(String oidString)
Return true if the string matches the Data ObjectIdentifer.
Parameters:
oidString - Object Identifier string.
Returns:
true, if the string matches the Data ObjectIdentifier, false otherwise.

isSignedData

public static boolean isSignedData(String oidString)
Return true if the string matches the SignedData ObjectIdentifer.
Parameters:
oidString - Object Identifier string.
Returns:
true, if the string matches the SignedData ObjectIdentifier, false otherwise.

isEnvelopedData

public static boolean isEnvelopedData(String oidString)
Return true if the string matches the EnvelopedData ObjectIdentifer.
Parameters:
oidString - Object Identifier string.
Returns:
true, if the string matches the EnvelopedData ObjectIdentifier, false otherwise.

isSignedAndEnvelopedData

public static boolean isSignedAndEnvelopedData(String oidString)
Return true if the string matches the SignedAndEnvelopedData ObjectIdentifer.
Parameters:
oidString - Object Identifier string.
Returns:
true, if the string matches the SignedAndEnvelopedData ObjectIdentifier, false otherwise.

isDigestedData

public static boolean isDigestedData(String oidString)
Return true if the string matches the DigestedData ObjectIdentifer.
Parameters:
oidString - Object Identifier string.
Returns:
true, if the string matches the DigestedData ObjectIdentifier, false otherwise.

isEncryptedData

public static boolean isEncryptedData(String oidString)
Return true if the string matches the EncryptedData ObjectIdentifer.
Parameters:
oidString - Object Identifier string.
Returns:
true, if the string matches the EncryptedData ObjectIdentifier, false otherwise.

isNetscapeCertSequence

public static boolean isNetscapeCertSequence(String oidString)
Return true if the string matches the NetscapeCertSequence ObjectIdentifer.
Parameters:
oidString - Object Identifier string.
Returns:
true, if the string matches the NetscapeCertSequence ObjectIdentifier, false otherwise.

isData

public static boolean isData(ObjectIdentifier oid)
Return true if the ObjectIdentifier matches the Data ObjectIdentifer.
Parameters:
oid - ObjectIdentifier
Returns:
true, if the oid matches the Data ObjectIdentifier, false otherwise.

isSignedData

public static boolean isSignedData(ObjectIdentifier oid)
Return true if the ObjectIdentifier matches the SignedData ObjectIdentifer.
Parameters:
oid - ObjectIdentifier
Returns:
true, if the oid matches the SignedData ObjectIdentifier, false otherwise.

isEnvelopedData

public static boolean isEnvelopedData(ObjectIdentifier oid)
Return true if the ObjectIdentifier matches the EnvelopedData ObjectIdentifer.
Parameters:
oid - ObjectIdentifier
Returns:
true, if the oid matches the EnvelopedData ObjectIdentifier, false otherwise.

isSignedAndEnvelopedData

public static boolean isSignedAndEnvelopedData(ObjectIdentifier oid)
Return true if the ObjectIdentifier matches the SignedAndEnvelopedData ObjectIdentifer.
Parameters:
oid - ObjectIdentifier
Returns:
true, if the oid matches the SignedAndEnvelopedData ObjectIdentifier, false otherwise.

isDigestedData

public static boolean isDigestedData(ObjectIdentifier oid)
Return true if the ObjectIdentifier matches the DigestedData ObjectIdentifer.
Parameters:
oid - ObjectIdentifier
Returns:
true, if the oid matches the DigestedData ObjectIdentifier, false otherwise.

isEncryptedData

public static boolean isEncryptedData(ObjectIdentifier oid)
Return true if the ObjectIdentifier matches the EncryptedData ObjectIdentifer.
Parameters:
oid - ObjectIdentifier
Returns:
true, if the oid matches the EncryptedData ObjectIdentifier, false otherwise.

isNetscapeCertSequence

public static boolean isNetscapeCertSequence(ObjectIdentifier oid)
Return true if the ObjectIdentifier matches the NetscapeCertSequence ObjectIdentifer.
Parameters:
oid - ObjectIdentifier
Returns:
true, if the oid matches the NetscapeCertSequence ObjectIdentifier, false otherwise.

getDigestAlgorithm

public static String getDigestAlgorithm(String digestSignatureAlgorithm)
                                 throws NoSuchAlgorithmException
Return the message digest AlgorithmId object for the specified message digest and signature algorithm. If a message digest and signature algorithm * combination is specified, this method will extract the message digest AlgorithmId.
Parameters:
digestsignatureAlgorithm - message digest and signature algorithm: "MD2", "MD5", "SHA1", "MD2/RSA", "MD5/RSA", "SHA1/DSA", or "SHA1/RSA"
Returns:
AlgorithmId matching the specified message digest algorithm
Throws:
NoSuchAlgorithmException - on invalid algorithm errors.

getDigestAlgorithm

public static String getDigestAlgorithm(String digestSignatureAlgorithm,
                                        String provider)
                                 throws NoSuchAlgorithmException
Return the message digest AlgorithmId object for the specified message digest and signature algorithm. If a message digest and signature algorithm * combination is specified, this method will extract the message digest AlgorithmId.
Parameters:
digestsignatureAlgorithm - message digest and signature algorithm: "MD2", "MD5", "SHA1", "MD2/RSA", "MD5/RSA", "SHA1/DSA", or "SHA1/RSA"
provider - the provider to be used
Returns:
AlgorithmId matching the specified message digest algorithm
Throws:
NoSuchAlgorithmException - on invalid algorithm errors.

getDigestAlgorithm

public static String getDigestAlgorithm(AlgorithmId alg)
                                 throws NoSuchAlgorithmException
Return the message digest AlgorithmId object for the specified message digest and signature AlgorithmId. If a message digest and signature algorithm combination is specified, this method will extract the message digest AlgorithmId.
Parameters:
alg - message digest and signature AlgorithmId
Returns:
AlgorithmId matching the specified message digest algorithm
Throws:
NoSuchAlgorithmException - on invalid algorithm errors.

getDigestAlgorithm

public static String getDigestAlgorithm(AlgorithmId alg,
                                        String provider)
                                 throws NoSuchAlgorithmException
Return the message digest AlgorithmId object for the specified message digest and signature AlgorithmId. If a message digest and signature algorithm combination is specified, this method will extract the message digest AlgorithmId.
Parameters:
alg - message digest and signature AlgorithmId
provider - the provider to be used
Returns:
AlgorithmId matching the specified message digest algorithm
Throws:
NoSuchAlgorithmException - on invalid algorithm errors.

getSignatureAlgorithm

public static String getSignatureAlgorithm(String digestSignatureAlgorithm)
                                    throws NoSuchAlgorithmException
Return the signature AlgorithmId object for the specified message digest and signature algorithm. If a message digest and signature algorithm combination is specified, this method will extract the signature AlgorithmId.
Parameters:
digestsignatureAlgorithm - message digest and signature algorithm: "RSA", "DSA", "MD2/RSA", "MD5/RSA", "SHA1/DSA", or "SHA1/RSA"
Returns:
AlgorithmId matching the specified signature algorithm
Throws:
NoSuchAlgorithmException - on invalid algorithm errors.

getSignatureAlgorithm

public static String getSignatureAlgorithm(AlgorithmId alg)
                                    throws NoSuchAlgorithmException
Return the signature AlgorithmId object for the specified message digest and signature AlgorithmId. If a message digest and signature algorithm combination is specified, this method will extract the signature AlgorithmId.
Parameters:
alg - message digest and signature AlgorithmId
Returns:
AlgorithmId matching the specified signature algorithm
Throws:
NoSuchAlgorithmException - on invalid algorithm errors.

getMACAlgorithm

public static String getMACAlgorithm(String macAlgorithm)
                              throws NoSuchAlgorithmException
Return the MAC AlgorithmId object for the specified MAC algorithm.
Parameters:
macAlgorithm - MAC algorithm: "HmacSHA"
Returns:
AlgorithmId matching the specified MAC algorithm
Throws:
NoSuchAlgorithmException - on invalid algorithm errors.

getMACAlgorithm

public static String getMACAlgorithm(AlgorithmId alg)
                              throws NoSuchAlgorithmException
Return the MAC AlgorithmId object for the specified MAC AlgorithmId.
Parameters:
alg - MAC algorithm
Returns:
AlgorithmId matching the specified MAC algorithm
Throws:
NoSuchAlgorithmException - on invalid algorithm errors.

getDigestSignatureAlgorithm

public static String getDigestSignatureAlgorithm(String digestAlgorithm,
                                                 String signatureAlgorithm)
                                          throws NoSuchAlgorithmException
Combine the message digest and signature algorithms and return a combined AlgorithmId representing the message digest and signature algorithm. The returned algorithm is a result of the following combinations.
Digest Algorithm Signature Algorithm Digest/Signature Algorithm
null md2/rsa md2/rsa
md2 rsa md2/rsa
md2 md2/rsa md2/rsa
md2/rsa md2/rsa md2/rsa
null md5/rsa md5/rsa
md5 rsa md5/rsa
md5 md5/rsa md5/rsa
md5/rsa md5/rsa md5/rsa
null sha1/dsa sha1/dsa
sha1 dsa sha1/dsa
sha1 sha1/dsa sha1/dsa
sha1/dsa sha1/dsa sha1/dsa
null sha1/rsa sha1/rsa
sha1 rsa sha1/rsa
sha1 sha1/rsa sha1/rsa
sha1/rsa sha1/rsa sha1/rsa

Parameters:
digestAlgorithm - message digest algorithm
signatureAlgorithm - signature algorithm
Returns:
AlgorithmId matching the combined message digest and signature algorithm
Throws:
NoSuchAlgorithmException - on invalid algorithm errors.

getDigestSignatureAlgorithm

public static String getDigestSignatureAlgorithm(String digestAlgorithm,
                                                 String signatureAlgorithm,
                                                 String provider)
                                          throws NoSuchAlgorithmException
Parameters:
digestAlgorithm - message digest algorithm
signatureAlgorithm - signature algorithm
provider - the provider to be used
Returns:
AlgorithmId matching the combined message digest and signature algorithm
Throws:
NoSuchAlgorithmException - on invalid algorithm errors.

getDigestSignatureAlgorithm

public static String getDigestSignatureAlgorithm(AlgorithmId digestAlg,
                                                 AlgorithmId signatureAlg)
                                          throws NoSuchAlgorithmException
Combine the message digest and signature algorithms and return a combined AlgorithmId representing the message digest and signature algorithm.
Parameters:
digestAlg - message digest AlgorithmId
signatureAlg - signature AlgorithmId
Returns:
AlgorithmId matching the combined message digest and signature algorithm
Throws:
NoSuchAlgorithmException - on invalid algorithm errors.

getDigestSignatureAlgorithm

public static String getDigestSignatureAlgorithm(AlgorithmId digestAlg,
                                                 AlgorithmId signatureAlg,
                                                 String provider)
                                          throws NoSuchAlgorithmException
Combine the message digest and signature algorithms and return a combined AlgorithmId representing the message digest and signature algorithm.
Parameters:
digestAlg - message digest AlgorithmId
signatureAlg - signature AlgorithmId
provider - signature AlgorithmId
Returns:
AlgorithmId matching the combined message digest and signature algorithm
Throws:
NoSuchAlgorithmException - on invalid algorithm errors.