iaik.asn1.structures
Class AlgorithmID

java.lang.Object
  |
  +--iaik.asn1.structures.AlgorithmID
All Implemented Interfaces:
ASN1Type, Cloneable

public class AlgorithmID
extends Object
implements ASN1Type, Cloneable

This class implements the ASN.1 type "AlgorithmIdentifier".

An AlgorithmID object unequivocally identifies some specific algorithm by assigning a particular ObjectID to it. An algorithmID optionally may include algorithm parameters:

 AlgorithmIdentifier  ::=  SEQUENCE  {
      algorithm               OBJECT IDENTIFIER,
      parameters              ANY DEFINED BY algorithm OPTIONAL  }
 
An AlgorithmID object may be, for instance, used for specifying the signature algorithm when signing a X509Certificate, e,g.:

 X509Certificate cert = new X509Certificate();
   ...
 cert.sign(AlgorithmID.md5WithRSAEncryption, issuerPrivateKey);
 

This class statically registers AlgortihmIDs for several public key, key exchange, symmetric, signature and message digest algorithms. AlgorithmIDs that are already statically registered by this class easily may be obtained by only calling their corresponding parameter names, e.g.:

 AlgorithmID algID = AlgorithmID.md5WithRSAEncryption;
 
AttentionThis static registration part of this class only associates one specific object identifier with a particular AlgorithmID. If you intend to use another OID than the registered one, you should call the AlgorithmID(String objectID, String name, String implementation) constructor for registering the OID as alternative OID for the specific algorithm, where objectID indicates the OID in mind, name specifies a name for the OID, and implementationName a string constant to be used for querying for an implementaion of the algorithm. This constant may be the specific algorithm´s standard name, a registered algorithm alias (but preferably not an OID alias!) (see IAIK provider), or a proper "transformation string" (e.g. "DES/CBC/PKCS5Padding") when dealing with a Cipher algorithm. After registration has been performed, the getSignatureInstance(), getMessageDigestInstance(), getCipherInstance(), getKeyAgreementInstance(), or the getInstance() method may be used to search for an implementation of the corresponding algorithm, whereas getInstance() steps through all the other algorithm types, e.g.:
 AlgorithmID algID = AlgorithmID.dsa;
 Signature dsa = algID.getSignatureInstance();
 //or:
 Signature dsa = (Signature)algID.getInstance();
 
Unfortunately sometimes there exist multiple object identifiers associated with the same algorithm. Where recognized, the IAIK provider) registers such object identifiers as aliases for the specific algorithm. Consider, for instance, the two OID strings "1.3.14.3.2.29" and "1.2.840.113549.1.1.5", both identifying the "sha1WithRSAEncryption" signature algorithm. Both OID strings are registered by the IAIK provider as aliases for the "SHA/RSA" algorithm. However the sha1WithRSAEncryption variable of this class only associates the "1.2.840.113549.1.1.5" object identifier with the "SHA/RSA" algorithm by statically calling
 public static AlgorithmID sha1WithRSAEncryption =
    new AlgorithmID("1.2.840.113549.1.1.5", "sha1WithRSAEncryption", "SHA/RSA");
 
Now, if you prefer to use "1.3.14.3.2.29" instead of "1.2.840.113549.1.1.5" you additionally may register this OID by calling:
  AlgorithmID algID =
    new AlgorithmID("1.3.14.3.2.29", "sha1WithRSAEncryption", "SHA/RSA");
 
Notice, that this will not discard the predefined AlgorithmID.sha1WithRSAEncryption. Accessing AlgorithmID.sha1WithRSAEncryption, again will show 1.3.14.3.2.29. However, you may access your new algorithmID with variable algID you have just created, and when parsing an algorithmID both OIDs will be recognized and handeld properly. Note that proper parsing for "SHA/RSA" with "1.3.14.3.2.29" already is ensured by alias registration in the IAIK provider. However you may wish to create a new "SHA/RSA" AlgorithmID for "1.3.14.3.2.29", or you may know of a object ID which already is not registered as alias (in fact, "1.3.14.3.2.29" already is registered by variable sha1WithRSAEncryption_, so above may only serve as an example) . Or you may deal with a cipher where alias registration may not satisfy since padding scheme and cipher mode maybe required. The, for instance, des_CBC cipher algorithmID statically is registered by using the "DES/CBC/PKCS5Padding" transformation string as implementation name:
 public static AlgorithmID des_CBC =
    new AlgorithmID("1.3.14.3.2.7", "DES-CBC", "DES/CBC/PKCS5Padding");
 

For defining AlgorithmIDs for algorithms not implemented by the IAIK provider, this class uses the AlgorithmID(String objectID, String name) constructor.

If you want to change the object identifier of an already existing AlgorithmID permanently, you may use the changeObjectID(AlgorithmID algID, ObjectID oid) or changeOIDString(AlgorithmID algID, String oidString) method; the latter adopts any existing name or shortName from the old oid. With JDK 1.2 the SUN provider, for instance, has changed the algorithm oid of the DSA algorithm from 1.3.14.3.2.12 to 1.2.840.10040.4.1, as also done by the IAIK provider. An application wishing to use 1.3.14.3.2.12 may allocate it by:

 AlgorithmID.changeOIDString(AlgorithmID.dsa, "1.3.14.3.2.12");
 
or
 ObjectID oid = new ObjectID("1.3.14.3.2.12", "DSA", "DSA");
 AlgorithmID.changeObjectID(AlgorithmID.dsa, oid);
 
Attention You should clone an algorithmID before adding parameters to avoid unintentional parameter allocation!

Version:
File Revision 76
See Also:
ASN1Type, ASN1Object, ObjectID

Field Summary
static AlgorithmID aes128_CBC
          Creates an AlgorithmID for the AES-128 symmetric block cipher used in CBC mode.
static AlgorithmID aes192_CBC
          Creates an AlgorithmID for the AES-192 symmetric block cipher used in CBC mode.
static AlgorithmID aes256_CBC
          Creates an AlgorithmID for the AES-256 symmetric block cipher used in CBC mode.
protected static Hashtable algorithms
          Reverse implementation repository.
static AlgorithmID arcfour
          Creates an AlgorithmID for the ARCFOUR stream cipher.
static AlgorithmID cast5_CBC
          Creates an AlgorithmID for the CAST5 symmetric block cipher used in CBC mode.
static AlgorithmID cms_3DES_wrap
          Creates an AlgorithmID for the CMS3DESwrap key wrap algorithm for wrapping 3DES content encryption keys with 3DES key encryption keys (RFC 2630).
static AlgorithmID cms_cast5_wrap
          Creates an AlgorithmID for the CMSCAST128wrap key wrap algorithm for wrapping CAST128 content encryption keys with CAST128 key encryption keys (RFC 2984).
static AlgorithmID cms_idea_wrap
          Creates an AlgorithmID for the CMSIDEAwrap key wrap algorithm for wrapping IDEA content encryption keys with IDEA key encryption keys (RFC 3058).
static AlgorithmID cms_rc2_wrap
          Creates an AlgorithmID for the CMSRC2wrap key wrap algorithm for wrapping RC2 content encryption keys with RC2 key encryption keys (RFC 2630).
static AlgorithmID des_CBC
          Creates an AlgorithmID for the DES symmetric block cipher used in CBC mode.
static AlgorithmID des_EDE3_CBC
          Creates an AlgorithmID for the Triple DES symmetric block cipher used in CBC mode.
static AlgorithmID dhKeyAgreement
          Creates an AlgorithmID for the Diffie-Hellman key exchange algorithm.
static AlgorithmID dsa
          Creates an AlgorithmID for the DSA algorithm (used with KeyFactories).
static AlgorithmID dsa_
          Creates an alternative AlgorithmID for the DSA algorithm (used with key factories).
static AlgorithmID dsa_With_SHA1
          Creates an alternative AlgorithmID for the dsaWithSHA1 signature algorithm.
static AlgorithmID dsaWithSHA
          Creates an AlgorithmID for the dsaWithSHA signature algorithm (addresses the same Signature engine as dsaWithSHA1).
static AlgorithmID dsaWithSHA1
          Creates an AlgorithmID for the dsaWithSHA1 signature algorithm.
static AlgorithmID ecdsa
          Creates an AlgorithmID for the ECDSA algorithm (used with key factories).
static AlgorithmID ecdsa_With_SHA1
          Creates an AlgorithmID for the ecdsa-with-SHA1 signature algorithm.
static AlgorithmID esdh
          Creates an AlgorithmID for identifying public Ephemeral-Static Diffie-Hellman keys.
static AlgorithmID esdhKeyAgreement
          Creates an AlgorithmID for the Ephemeral-Static Diffie-Hellman key agreement algorithm (RFC 2631).
static AlgorithmID hMAC_MD5
          Creates an AlgorithmID for the hMAC-SHA1 message digest algorithm.
static AlgorithmID hMAC_RIPEMD160
          Creates an AlgorithmID for the hMAC-RIPEMD160 message digest algorithm.
static AlgorithmID hMAC_SHA1
          Creates an AlgorithmID for the hMAC-SHA1 message digest algorithm.
static AlgorithmID hMAC_SHA1_
          Creates an alternative (PKCS#5) AlgorithmID for the hMAC-SHA1 message digest algorithm.
static AlgorithmID idea_CBC
          Creates an AlgorithmID for the IDEA symmetric block cipher used in CBC mode.
protected static Hashtable implementations
          Implementation repository.
static AlgorithmID md2
          Creates an AlgorithmID for the MD2 message digest algorithm.
static AlgorithmID md2WithRSAEncryption
          Creates an AlgorithmID for the md2WithRSAEncryption signature algorithm.
static AlgorithmID md4
          Creates an AlgorithmID for the MD4 message digest algorithm.
static AlgorithmID md4WithRSAEncryption
          Creates an AlgorithmID for the md4WithRSAEncryption signature algorithm.
static AlgorithmID md5
          Creates an AlgorithmID for the MD5 message digest algorithm.
static AlgorithmID md5WithRSAEncryption
          Creates an AlgorithmID for the md5WithRSAEncryption signature algorithm.
static AlgorithmID mgf1
          Creates an AlgorithmID for the PKCS#1v2.1 MGF1 mask generation function.
static AlgorithmID pbeWithMD5AndDES_CBC
          Creates an AlgorithmID for the pbeWithMD5AndDES_CBC key-encryption algorithm as defined by PKCS#5.
static AlgorithmID pbeWithSHAAnd128BitRC2_CBC
          Creates an AlgorithmID for the pbeWithSHAAnd128BitRC2_CBC key-encryption algorithm as defined by PKCS#12.
static AlgorithmID pbeWithSHAAnd128BitRC4
          Creates an AlgorithmID for the pbeWithSHAAnd128BitRC4 key-encryption algorithm as defined by PKCS#12.
static AlgorithmID pbeWithSHAAnd2_KeyTripleDES_CBC
          Creates an AlgorithmID for the pbeWithSHAAnd2_KeyTripleDES_CBC key-encryption algorithm as defined by PKCS#12.
static AlgorithmID pbeWithSHAAnd3_KeyTripleDES_CBC
          Creates an AlgorithmID for the pbeWithSHAAnd3_KeyTripleDES_CBC key-encryption algorithm as defined by PKCS#12.
static AlgorithmID pbeWithSHAAnd40BitRC2_CBC
          Creates an AlgorithmID for the pbeWithSHAAnd40BitRC2_CBC key-encryption algorithm as defined by PKCS#12.
static AlgorithmID pbeWithSHAAnd40BitRC4
          Creates an AlgorithmID for the pbeWithSHAAnd40BitRC4 key-encryption algorithm as defined by PKCS#12.
static AlgorithmID pbkdf2
          Creates an AlgorithmID for the PBKDF2 key-derivation function as defined by PKCS#5 ((key generator).
static AlgorithmID pSpecified
          Creates an AlgorithmID for the PKCS#1v2.1 pSpecified PSourceAlgorithm.
static AlgorithmID rc2_CBC
          Creates an AlgorithmID for the RC2 [TM] symmetric block cipher used in CBC mode.
static AlgorithmID rc4
          Creates an AlgorithmID for the RC4 [TM] stream cipher.
static AlgorithmID rc5_CBC
          Creates an AlgorithmID for the RC5 [TM] symmetric block cipher used in CBC mode.
static AlgorithmID ripeMd128
          Creates an AlgorithmID for the RipeMd128 message digest algorithm.
static AlgorithmID ripeMd160
          Creates an AlgorithmID for the RipeMd160 message digest algorithm.
static AlgorithmID rsa
          Creates an AlgorithmID for the RSA public key algorithm.
static AlgorithmID rsaEncryption
          Creates an AlgorithmID for the RSA encryption signature algorithm.
static AlgorithmID rsaesOAEP
          Creates an AlgorithmID for the RSAES-OAEP encryption scheme.
static AlgorithmID rsaSignatureWithRipemd128
          Creates an AlgorithmID for the rsaSignatureWithRipemd128 signature algorithm.
static AlgorithmID rsaSignatureWithRipemd160
          Creates an AlgorithmID for the rsaSignatureWithRipemd128 signature algorithm.
static AlgorithmID rsassaPss
          Creates an AlgorithmID for the PKCS#1v2.1 RSASSA-PSS signature algorithm.
static AlgorithmID sha
          Creates an AlgorithmID for the SHA message digest algorithm.
static AlgorithmID sha1
          Creates an AlgorithmID for the SHA1 message digest algorithm which is the same as SHA.
static AlgorithmID sha1WithRSAEncryption
          Creates an AlgorithmID for the sha1WithRSAEncryption signature algorithm.
static AlgorithmID sha1WithRSAEncryption_
          Creates an alternative AlgorithmID for the sha1WithRSAEncryption signature algorithm.
static AlgorithmID sha256
          Creates an AlgorithmID for the SHA-256 message digest algorithm.
static AlgorithmID sha256WithRSAEncryption
          Creates an AlgorithmID for the sha256WithRSAEncryption signature algorithm (PKCS#1v2).
static AlgorithmID sha384
          Creates an AlgorithmID for the SHA-384 message digest algorithm.
static AlgorithmID sha384WithRSAEncryption
          Creates an AlgorithmID for the sha384WithRSAEncryption signature algorithm (PKCS#1v2).
static AlgorithmID sha512
          Creates an AlgorithmID for the SHA-384 message digest algorithm.
static AlgorithmID sha512WithRSAEncryption
          Creates an AlgorithmID for the sha512WithRSAEncryption signature algorithm (PKCS#1v2).
static AlgorithmID ssdhKeyAgreement
          Creates an AlgorithmID for the Static-Static Diffie-Hellman key agreement algorithm (CMS).
 
Constructor Summary
AlgorithmID()
          Default constructor.
AlgorithmID(ASN1Object algorithmID)
          Creates a new AlgorithmID from an ASN1Object.
AlgorithmID(DerInputStream is)
          Decodes an AlgorithmID from a DerInputStream.
AlgorithmID(ObjectID algorithm)
          Creates a new AlgorithmID from an ObjectID.
AlgorithmID(ObjectID algorithm, ASN1Object parameter)
          Creates a new AlgorithmID from an ObjectID and algorithm parameters.
AlgorithmID(String objectID, String name)
          Creates a new AlgorithmID from an object identifier and a name.
AlgorithmID(String objectID, String name, String implementationName)
          Creates a new AlgorithmID from an object identifier, a name and and implementation name.
AlgorithmID(String objectID, String name, String implementationName, boolean useNULLForAbsentParameters)
          Creates a new AlgorithmID from an object identifier, a name and and implementation name.
 
Method Summary
static boolean changeObjectID(AlgorithmID algID, ObjectID oid)
          Changes the object identifier of the given AlgorithmID object.
static boolean changeOIDString(AlgorithmID algID, String oidString)
          Changes the object identifier string of the given AlgorithmID object.
 Object clone()
          Returns a clone of this AlgorithmID.
 void decode(ASN1Object algorithmID)
          Decodes an AlgorithmID from the given ASN1Object.
 void encodeAbsentParametersAsNull(boolean useNULLForAbsentParameters)
          Decide whether to encode absent parameters as NULL or omit the parameters field.
 boolean equals(Object obj)
          Compares this AlgorithmID with the given AlgorithmID.
 ObjectID getAlgorithm()
          Returns the ObjectID of the algorithm.
static AlgorithmID getAlgorithmID(String implementationName)
          Returns an AlgorithmID for the given implementation name.
 AlgorithmParameters getAlgorithmParameters()
          Returns the parameters of the algorithm as java.security.AlgorithmParameters object.
 AlgorithmParameters getAlgorithmParameters(String algorithm)
          Returns the parameters of the algorithm as java.security.AlgorithmParameters object.
 AlgorithmParameters getAlgorithmParameters(String algorithm, String provider)
          Returns the parameters of the algorithm as java.security.AlgorithmParameters object.
 Cipher getCipherInstance()
          Tries to find a Cipher implementation for this AlgorithmIdentifier.
 Cipher getCipherInstance(String provider)
          Tries to find a provider-specific Cipher implementation for this AlgorithmIdentifier.
 String getImplementationName()
          Returns the name for an implementation of this algorithm.
 Object getInstance()
          Tries to find an implementation for this AlgorithmIdentifier.
 Object getInstance(String provider)
          Tries to find a provider specific implementation for this AlgorithmIdentifier.
 KeyAgreement getKeyAgreementInstance()
          Tries to find a KeyAgreement implementation for this AlgorithmIdentifier.
 KeyAgreement getKeyAgreementInstance(String provider)
          Tries to find a provider-specific KeyAgreement implementation for this AlgorithmIdentifier.
 KeyFactory getKeyFactoryInstance()
          Tries to find a KeyFactory implementation for this AlgorithmIdentifier.
 KeyFactory getKeyFactoryInstance(String provider)
          Tries to find a provider-specific KeyFactory implementation for this AlgorithmIdentifier.
 KeyGenerator getKeyGeneratorInstance()
          Tries to find a KeyGenerator implementation for this AlgorithmIdentifier.
 KeyGenerator getKeyGeneratorInstance(String provider)
          Tries to find a provider-specific KeyGenerator implementation for this AlgorithmID.
 KeyPairGenerator getKeyPairGeneratorInstance()
          Tries to find a KeyPairGenerator implementation for this AlgorithmIdentifier.
 KeyPairGenerator getKeyPairGeneratorInstance(String provider)
          Tries to find a provider-specific KeyPairGenerator implementation for this AlgorithmID.
 Mac getMacInstance()
          Tries to find a Mac implementation for this AlgorithmIdentifier.
 Mac getMacInstance(String provider)
          Tries to find a provider-specific Mac implementation for this AlgorithmIdentifier.
 MaskGenerationAlgorithm getMaskGenerationAlgorithmInstance()
          Tries to find an PKCS#1 MaskGenerationAlgorithm implementation for this AlgorithmIdentifier.
 MaskGenerationAlgorithm getMaskGenerationAlgorithmInstance(String provider)
          Tries to find an PKCS#1 MaskGenerationAlgorithm implementation for this AlgorithmIdentifier.
 MessageDigest getMessageDigestInstance()
          Tries to find a MessageDigest implementation for this AlgorithmIdentifier.
 MessageDigest getMessageDigestInstance(String provider)
          Tries to find a provider-specific MessageDigest implementation for this AlgorithmIdentifier.
 String getName()
          Returns the name registered for this AlgorithmID or the object identifier string if there is no name registered.
 ASN1Object getParameter()
          Returns the parameters of the algorithm as ASN1Object.
 String getRawImplementationName()
          Tries to get the raw inplementation name of the algorithm this AlgorithmID represents.
 SecretKeyFactory getSecretKeyFactoryInstance()
          Tries to find a SecretKeyFactory implementation for this AlgorithmIdentifier.
 SecretKeyFactory getSecretKeyFactoryInstance(String provider)
          Tries to find a provider-specific SecretKeyFactory implementation for this AlgorithmID.
 Signature getSignatureInstance()
          Tries to find a Signature implementation for this AlgorithmIdentifier.
 Signature getSignatureInstance(String provider)
          Tries to find a provider-specific Signature implementation for this AlgorithmIdentifier.
 int hashCode()
          Returns a hash code value for this object.
static void register(String objectID, String name, String implementationName)
          Registers an AlgorithmID for the given object identifier, a name and and implementation name.
 void setAlgorithmParameters(AlgorithmParameters parameters)
          Sets the parameters of the algorithm.
 void setParameter(ASN1Object parameters)
          Sets the parameters of the algorithm.
 ASN1Object toASN1Object()
          Returns the AlgorithmID as an (SEQUENCE) ASN1Object.
 ASN1Object toASN1Object(boolean useNULLForAbsentParameters)
          Returns the AlgorithmID as an (SEQUENCE) ASN1Object.
 String toString()
          Returns a string that represents this AlgorithmIdentifier.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

implementations

protected static Hashtable implementations
Implementation repository. Maps algorithmIDs to implementation names.

algorithms

protected static Hashtable algorithms
Reverse implementation repository. Maps implementation names to AlgorithmIDs.

dhKeyAgreement

public static AlgorithmID dhKeyAgreement
Creates an AlgorithmID for the Diffie-Hellman key exchange algorithm. For addressing it, use AlgorithmID.dhKeyAgreement.

esdhKeyAgreement

public static AlgorithmID esdhKeyAgreement
Creates an AlgorithmID for the Ephemeral-Static Diffie-Hellman key agreement algorithm (RFC 2631). For addressing it, use AlgorithmID.esdhKeyAgreement.

esdh

public static AlgorithmID esdh
Creates an AlgorithmID for identifying public Ephemeral-Static Diffie-Hellman keys. For addressing it, use AlgorithmID.esdh.

ssdhKeyAgreement

public static AlgorithmID ssdhKeyAgreement
Creates an AlgorithmID for the Static-Static Diffie-Hellman key agreement algorithm (CMS). For addressing it, use AlgorithmID.esdhKeyAgreement.

rsaEncryption

public static AlgorithmID rsaEncryption
Creates an AlgorithmID for the RSA encryption signature algorithm. For addressing it, use AlgorithmID.rsaEncryption.

md2WithRSAEncryption

public static AlgorithmID md2WithRSAEncryption
Creates an AlgorithmID for the md2WithRSAEncryption signature algorithm. For addressing it, use AlgorithmID.md2WithRSAEncryption.

md4WithRSAEncryption

public static AlgorithmID md4WithRSAEncryption
Creates an AlgorithmID for the md4WithRSAEncryption signature algorithm. For addressing it, use AlgorithmID.md4WithRSAEncryption.

md5WithRSAEncryption

public static AlgorithmID md5WithRSAEncryption
Creates an AlgorithmID for the md5WithRSAEncryption signature algorithm. For addressing it, use AlgorithmID.md5WithRSAEncryption.

sha1WithRSAEncryption_

public static AlgorithmID sha1WithRSAEncryption_
Creates an alternative AlgorithmID for the sha1WithRSAEncryption signature algorithm. For addressing it, use AlgorithmID.sha1WithRSAEncryption_.

sha1WithRSAEncryption

public static AlgorithmID sha1WithRSAEncryption
Creates an AlgorithmID for the sha1WithRSAEncryption signature algorithm. For addressing it, use AlgorithmID.sha1WithRSAEncryption.

sha256WithRSAEncryption

public static AlgorithmID sha256WithRSAEncryption
Creates an AlgorithmID for the sha256WithRSAEncryption signature algorithm (PKCS#1v2). For addressing it, use AlgorithmID.sha256WithRSAEncryption.

sha384WithRSAEncryption

public static AlgorithmID sha384WithRSAEncryption
Creates an AlgorithmID for the sha384WithRSAEncryption signature algorithm (PKCS#1v2). For addressing it, use AlgorithmID.sha384WithRSAEncryption.

sha512WithRSAEncryption

public static AlgorithmID sha512WithRSAEncryption
Creates an AlgorithmID for the sha512WithRSAEncryption signature algorithm (PKCS#1v2). For addressing it, use AlgorithmID.sha512WithRSAEncryption.

dsa_

public static AlgorithmID dsa_
Creates an alternative AlgorithmID for the DSA algorithm (used with key factories). For addressing it, use AlgorithmID.dsa_.

dsa

public static AlgorithmID dsa
Creates an AlgorithmID for the DSA algorithm (used with KeyFactories). For addressing it, use AlgorithmID.dsa.

dsa_With_SHA1

public static AlgorithmID dsa_With_SHA1
Creates an alternative AlgorithmID for the dsaWithSHA1 signature algorithm. For addressing it, use AlgorithmID.dsa_With_SHA1.

Note that the parameters field is omitted from the encoding if no parameters are set (i.e. absent parameters are NOT encoded as NULL!)


dsaWithSHA

public static AlgorithmID dsaWithSHA
Creates an AlgorithmID for the dsaWithSHA signature algorithm (addresses the same Signature engine as dsaWithSHA1). For addressing it, use AlgorithmID.dsaWithSHA.

Note that the parameters field is omitted from the encoding if no parameters are set (i.e. absent parameters are NOT encoded as NULL!)


dsaWithSHA1

public static AlgorithmID dsaWithSHA1
Creates an AlgorithmID for the dsaWithSHA1 signature algorithm. For addressing it, use AlgorithmID.dsaWithSHA1.

Note that the parameters field is omitted from the encoding if no parameters are set (i.e. absent parameters are NOT encoded as NULL!)


ecdsa

public static AlgorithmID ecdsa
Creates an AlgorithmID for the ECDSA algorithm (used with key factories). For addressing it, use AlgorithmID.ecdsa.

ecdsa_With_SHA1

public static AlgorithmID ecdsa_With_SHA1
Creates an AlgorithmID for the ecdsa-with-SHA1 signature algorithm. For addressing it, use AlgorithmID.ecdsa_With_SHA1.

Note that the parameters field is omitted from the encoding if no parameters are set (i.e. absent parameters are NOT encoded as NULL!)


rsaSignatureWithRipemd160

public static AlgorithmID rsaSignatureWithRipemd160
Creates an AlgorithmID for the rsaSignatureWithRipemd128 signature algorithm. For addressing it, use AlgorithmID.rsaSignatureWithRipemd160.

rsaSignatureWithRipemd128

public static AlgorithmID rsaSignatureWithRipemd128
Creates an AlgorithmID for the rsaSignatureWithRipemd128 signature algorithm. For addressing it, use AlgorithmID.rsaSignatureWithRipemd128.

rsassaPss

public static AlgorithmID rsassaPss
Creates an AlgorithmID for the PKCS#1v2.1 RSASSA-PSS signature algorithm. For addressing it, use AlgorithmID.rsassaPss.

mgf1

public static AlgorithmID mgf1
Creates an AlgorithmID for the PKCS#1v2.1 MGF1 mask generation function. For addressing it, use AlgorithmID.sha1WithRSAEncryption.

pbeWithMD5AndDES_CBC

public static AlgorithmID pbeWithMD5AndDES_CBC
Creates an AlgorithmID for the pbeWithMD5AndDES_CBC key-encryption algorithm as defined by PKCS#5. For addressing it, use AlgorithmID.pbeWithMD5AndDES_CBC.

pbeWithSHAAnd128BitRC4

public static AlgorithmID pbeWithSHAAnd128BitRC4
Creates an AlgorithmID for the pbeWithSHAAnd128BitRC4 key-encryption algorithm as defined by PKCS#12. For addressing it, use AlgorithmID.pbeWithSHAAnd128BitRC4.

pbeWithSHAAnd40BitRC4

public static AlgorithmID pbeWithSHAAnd40BitRC4
Creates an AlgorithmID for the pbeWithSHAAnd40BitRC4 key-encryption algorithm as defined by PKCS#12. For addressing it, use AlgorithmID.pbeWithSHAAnd40BitRC4.

pbeWithSHAAnd3_KeyTripleDES_CBC

public static AlgorithmID pbeWithSHAAnd3_KeyTripleDES_CBC
Creates an AlgorithmID for the pbeWithSHAAnd3_KeyTripleDES_CBC key-encryption algorithm as defined by PKCS#12. For addressing it, use AlgorithmID.pbeWithSHAAnd3_KeyTripleDES_CBC.

pbeWithSHAAnd2_KeyTripleDES_CBC

public static AlgorithmID pbeWithSHAAnd2_KeyTripleDES_CBC
Creates an AlgorithmID for the pbeWithSHAAnd2_KeyTripleDES_CBC key-encryption algorithm as defined by PKCS#12. For addressing it, use AlgorithmID.pbeWithSHAAnd2_KeyTripleDES_CBC.

pbeWithSHAAnd128BitRC2_CBC

public static AlgorithmID pbeWithSHAAnd128BitRC2_CBC
Creates an AlgorithmID for the pbeWithSHAAnd128BitRC2_CBC key-encryption algorithm as defined by PKCS#12. For addressing it, use AlgorithmID.pbeWithSHAAnd128BitRC2_CBC.

pbeWithSHAAnd40BitRC2_CBC

public static AlgorithmID pbeWithSHAAnd40BitRC2_CBC
Creates an AlgorithmID for the pbeWithSHAAnd40BitRC2_CBC key-encryption algorithm as defined by PKCS#12. For addressing it, use AlgorithmID.pbeWithSHAAnd40BitRC2_CBC.

pbkdf2

public static AlgorithmID pbkdf2
Creates an AlgorithmID for the PBKDF2 key-derivation function as defined by PKCS#5 ((key generator). For addressing it, use AlgorithmID.pbeWithSHAAnd40BitRC2_CBC.

rsa

public static AlgorithmID rsa
Creates an AlgorithmID for the RSA public key algorithm. For addressing it, use AlgorithmID.rsa.

rsaesOAEP

public static AlgorithmID rsaesOAEP
Creates an AlgorithmID for the RSAES-OAEP encryption scheme. For addressing it, use AlgorithmID.rsaesOAEP.

rc2_CBC

public static AlgorithmID rc2_CBC
Creates an AlgorithmID for the RC2 [TM] symmetric block cipher used in CBC mode. For addressing it, use AlgorithmID.rc2_CBC.

arcfour

public static AlgorithmID arcfour
Creates an AlgorithmID for the ARCFOUR stream cipher. For addressing it, use AlgorithmID.arcfour.

rc4

public static AlgorithmID rc4
Creates an AlgorithmID for the RC4 [TM] stream cipher. For addressing it, use AlgorithmID.rc4.

des_EDE3_CBC

public static AlgorithmID des_EDE3_CBC
Creates an AlgorithmID for the Triple DES symmetric block cipher used in CBC mode. For addressing it, use AlgorithmID.des_EDE3_CBC.

des_CBC

public static AlgorithmID des_CBC
Creates an AlgorithmID for the DES symmetric block cipher used in CBC mode. For addressing it, use AlgorithmID.des_CBC.

idea_CBC

public static AlgorithmID idea_CBC
Creates an AlgorithmID for the IDEA symmetric block cipher used in CBC mode. For addressing it, use AlgorithmID.des_CBC.

aes128_CBC

public static AlgorithmID aes128_CBC
Creates an AlgorithmID for the AES-128 symmetric block cipher used in CBC mode. For addressing it, use AlgorithmID.des_CBC.

aes192_CBC

public static AlgorithmID aes192_CBC
Creates an AlgorithmID for the AES-192 symmetric block cipher used in CBC mode. For addressing it, use AlgorithmID.des_CBC.

aes256_CBC

public static AlgorithmID aes256_CBC
Creates an AlgorithmID for the AES-256 symmetric block cipher used in CBC mode. For addressing it, use AlgorithmID.des_CBC.

cast5_CBC

public static AlgorithmID cast5_CBC
Creates an AlgorithmID for the CAST5 symmetric block cipher used in CBC mode. For addressing it, use AlgorithmID.cast5_CBC.

rc5_CBC

public static AlgorithmID rc5_CBC
Creates an AlgorithmID for the RC5 [TM] symmetric block cipher used in CBC mode. For addressing it, use AlgorithmID.rc5_CBC.

pSpecified

public static AlgorithmID pSpecified
Creates an AlgorithmID for the PKCS#1v2.1 pSpecified PSourceAlgorithm. For addressing it, use AlgorithmID.pSpecified.

md2

public static AlgorithmID md2
Creates an AlgorithmID for the MD2 message digest algorithm. For addressing it, use AlgorithmID.md2.

md4

public static AlgorithmID md4
Creates an AlgorithmID for the MD4 message digest algorithm. For addressing it, use AlgorithmID.md4.

md5

public static AlgorithmID md5
Creates an AlgorithmID for the MD5 message digest algorithm. For addressing it, use AlgorithmID.md5.

sha

public static AlgorithmID sha
Creates an AlgorithmID for the SHA message digest algorithm. For addressing it, use AlgorithmID.sha.

sha1

public static AlgorithmID sha1
Creates an AlgorithmID for the SHA1 message digest algorithm which is the same as SHA. For addressing it, use AlgorithmID.sha1.

sha256

public static AlgorithmID sha256
Creates an AlgorithmID for the SHA-256 message digest algorithm. For addressing it, use AlgorithmID.sha256.

sha384

public static AlgorithmID sha384
Creates an AlgorithmID for the SHA-384 message digest algorithm. For addressing it, use AlgorithmID.sha256.

sha512

public static AlgorithmID sha512
Creates an AlgorithmID for the SHA-384 message digest algorithm. For addressing it, use AlgorithmID.sha512.

ripeMd160

public static AlgorithmID ripeMd160
Creates an AlgorithmID for the RipeMd160 message digest algorithm. For addressing it, use AlgorithmID.ripeMd160.

ripeMd128

public static AlgorithmID ripeMd128
Creates an AlgorithmID for the RipeMd128 message digest algorithm. For addressing it, use AlgorithmID.ripeMd128.

hMAC_MD5

public static AlgorithmID hMAC_MD5
Creates an AlgorithmID for the hMAC-SHA1 message digest algorithm. For addressing it, use AlgorithmID.hMAC_MD5.

hMAC_SHA1_

public static AlgorithmID hMAC_SHA1_
Creates an alternative (PKCS#5) AlgorithmID for the hMAC-SHA1 message digest algorithm. For addressing it, use AlgorithmID.hMAC_SHA1_.

hMAC_SHA1

public static AlgorithmID hMAC_SHA1
Creates an AlgorithmID for the hMAC-SHA1 message digest algorithm. For addressing it, use AlgorithmID.hMAC_SHA1.

hMAC_RIPEMD160

public static AlgorithmID hMAC_RIPEMD160
Creates an AlgorithmID for the hMAC-RIPEMD160 message digest algorithm. For addressing it, use AlgorithmID.hMAC_RIPEMD160.

cms_3DES_wrap

public static AlgorithmID cms_3DES_wrap
Creates an AlgorithmID for the CMS3DESwrap key wrap algorithm for wrapping 3DES content encryption keys with 3DES key encryption keys (RFC 2630). For addressing it, use AlgorithmID.cms_3DES_wrap.

cms_rc2_wrap

public static AlgorithmID cms_rc2_wrap
Creates an AlgorithmID for the CMSRC2wrap key wrap algorithm for wrapping RC2 content encryption keys with RC2 key encryption keys (RFC 2630). For addressing it, use AlgorithmID.cms_rc2_wrap.

cms_idea_wrap

public static AlgorithmID cms_idea_wrap
Creates an AlgorithmID for the CMSIDEAwrap key wrap algorithm for wrapping IDEA content encryption keys with IDEA key encryption keys (RFC 3058). For addressing it, use AlgorithmID.cms_3DES_wrap.

cms_cast5_wrap

public static AlgorithmID cms_cast5_wrap
Creates an AlgorithmID for the CMSCAST128wrap key wrap algorithm for wrapping CAST128 content encryption keys with CAST128 key encryption keys (RFC 2984). For addressing it, use AlgorithmID.cms_3DES_wrap.
Constructor Detail

AlgorithmID

public AlgorithmID()
Default constructor. Creates an AlgorithmID object with null ObjectID and null parameters.

AlgorithmID

public AlgorithmID(String objectID,
                   String name)
Creates a new AlgorithmID from an object identifier and a name. The AlgorithmID parameters are set to NULL.
Parameters:
objectID - the object identifier of the algorithm as a string; e.g. "2.5.8.1.1"
name - the name for this object identifier; e.g "rsa"

AlgorithmID

public AlgorithmID(String objectID,
                   String name,
                   String implementationName)
Creates a new AlgorithmID from an object identifier, a name and and implementation name. The AlgorithmID parameters are set to NULL.
Parameters:
objectID - the object identifier of the algorithm as a string; e.g. "1.2.840.113549.3.7"
name - the name for this object identifier; e.g "DES-EDE3-CBC"
implementationName - the internal implementation name; e.g. "3DES/CBC/PKCS5Padding"

AlgorithmID

public AlgorithmID(String objectID,
                   String name,
                   String implementationName,
                   boolean useNULLForAbsentParameters)
Creates a new AlgorithmID from an object identifier, a name and and implementation name. The AlgorithmID parameters are set to NULL.

An application (e.g. X.509) may require to omit the parameters field in the AlgorihmID encoding of some specific algorithm (e.g. dsaWithSHA1, ecdsaWithSHA1) if no parameters are set. To decide whether absent parameters shall be encoded as ASN.1 NULL object or shall be omitted from the encoding at all, set parameter useNULLForAbsentParameters to true or false. Note that per default absent parameters are encoded as NULL by the static registered AlgorithmIDs of this class, except for those algorithms (like dsaWithSHA1, {@link #ecdsa_With_SHA1, ecdsaWithSHA1) where it is explicitly announced by the Javadoc that absent parameters are omitted.

Parameters:
objectID - the object identifier of the algorithm as a string; e.g. "1.2.840.113549.3.7"
name - the name for this object identifier; e.g "DES-EDE3-CBC"
implementationName - the internal implementation name; e.g. "3DES/CBC/PKCS5Padding"
useNULLForAbsentParameters - true if absent parameters shall be encoded as NULL, false if absent parameters shall be omitted from the encoding

AlgorithmID

public AlgorithmID(ObjectID algorithm)
Creates a new AlgorithmID from an ObjectID. The parameters are set to NULL.
Parameters:
algorithm - the ObjectID of the algorithm

AlgorithmID

public AlgorithmID(ObjectID algorithm,
                   ASN1Object parameter)
Creates a new AlgorithmID from an ObjectID and algorithm parameters.
Parameters:
algorithm - the ObjectID of the algorithm
parameter - the algorithm parameters

AlgorithmID

public AlgorithmID(ASN1Object algorithmID)
            throws CodingException
Creates a new AlgorithmID from an ASN1Object. The supplied ASN1Object represents an already existing AlgorithmID that may have been created by means of the toASN1Object() method.
Parameters:
algorithmID - the AlgorithmID as ASN1Object
Throws:
CodingException - if the ASN1Object is no AlgorithmID

AlgorithmID

public AlgorithmID(DerInputStream is)
            throws IOException
Decodes an AlgorithmID from a DerInputStream.

The given DerInputStream supplies DER encoded data that represents an already existing AlgorithmID.

Parameters:
is - the DerInputStream supplying the DER encoded ASN1Object
Throws:
IOException - if an I/O or decoding error occurs
Method Detail

changeObjectID

public static boolean changeObjectID(AlgorithmID algID,
                                     ObjectID oid)
Changes the object identifier of the given AlgorithmID object.

This method may be used to allocate a new object identifier to an already existing AlgorithmID. With JDK 1.2 the SUN provider, for instance, has changed the algorithm oid of the DSA algorithm from 1.3.14.3.2.12 to 1.2.840.10040.4.1, whereas IAIK continues to use 1.3.14.3.2.12. An application wishing to use the new OID, can allocate it by using this method, e.g.:

 ObjectID oid = new ObjectID("1.2.840.10040.4.1", "DSA");
 AlgorithmID.changeObjectID(AlgorithmID.dsa, oid);
 
If you only want to change the OID string, but keep name and shortName, you may use method changeOIDString(AlgorithmID algID, String oidString).
Parameters:
algID - the AlgorithmID to which a new OID shall be allocated
oid - the new object identifier
Returns:
true if the OID successfully has been changed, false otherwise

changeOIDString

public static boolean changeOIDString(AlgorithmID algID,
                                      String oidString)
Changes the object identifier string of the given AlgorithmID object.

This method may be used to allocate a new object identifier to an already existing AlgorithmID. With JDK 1.2 the SUN provider, for instance, has changed the algorithm oid of the DSA algorithm from 1.3.14.3.2.12 to 1.2.840.10040.4.1, whereas IAIK continues to use 1.3.14.3.2.12. An application wishing to use the new OID, can allocate it by using this method, e.g.:

 AlgorithmID.changeOIDString(AlgorithmID.dsa, "1.2.840.10040.4.1");
 
This method adopts any registered name and shortName from the old object identifer; and only changes the OID string. To set an entire new object identifier, use method changeObjectID(AlgorithmID, ObjectID).
Parameters:
algID - the AlgorithmID to which a new OID shall be allocated
oid - the new object identifier
Returns:
true if the OID successfully has been changed, false otherwise

register

public static void register(String objectID,
                            String name,
                            String implementationName)
Registers an AlgorithmID for the given object identifier, a name and and implementation name. This method provides an alternative for registering an algorithm OID without the necessity of creating an AlgorithmID object, e.g.:
 AlgorithmID.register("1.3.14.3.2.12", "DSA", "DSA");
 
as alternative to:
 new AlgorithmID("1.3.14.3.2.12", "DSA", "DSA");
 
Parameters:
objectID - the object identifier of the algorithm as a string; e.g. "1.2.840.113549.3.7"
name - the name for this object identifier; e.g "DES-EDE3-CBC"
implementationName - the internal implementation name; e.g. "3DES/CBC/PKCS5Padding"

getAlgorithmID

public static AlgorithmID getAlgorithmID(String implementationName)
Returns an AlgorithmID for the given implementation name.

This method may be used to search for an AlgorithmID when the implementation name is known. To get, for instance, an AlgorithmID for "3DES/CBC/PKCS5Padding" just try:

 AlgorithmID algID = AlgorithmID.getAlgorithmID("3DES/CBC/PKCS5Padding");
 if (algID != null) {
   ...
 }
Parameters:
implementationName - the implementation name (e.g. "3DES/CBC/PKCS5Padding") for which a AlgorithmID shall be searched
Returns:
an AlgorithmID object for the given implementation name, or null if no AlgorithmID for this implementation name is registered

encodeAbsentParametersAsNull

public void encodeAbsentParametersAsNull(boolean useNULLForAbsentParameters)
Decide whether to encode absent parameters as NULL or omit the parameters field.

An application (e.g. X.509) may require to omit the parameters field in the AlgorihmID encoding of some specific algorithm (e.g. dsaWithSHA1, ecdsaWithSHA1) if no parameters are set. This method may be used to decide whether absent parameters shall be encoded as ASN.1 NULL object or shall be omitted from the encoding at all. Note that per default absent parameters are encoded as NULL by the static registered AlgorithmIDs of this class, except for those algorithms (like dsaWithSHA1, {@link #ecdsa_With_SHA1, ecdsaWithSHA1) where it is explicitly announced by the Javadoc that absent parameters are omitted.

Parameters:
useNULLForAbsentParameters - true if absent parameters shall be encoded as NULL, false if absent parameters shall be omitted from the encoding

decode

public void decode(ASN1Object algorithmID)
            throws CodingException
Decodes an AlgorithmID from the given ASN1Object.

The supplied ASN1Object represents an already existing AlgorithmID that may have been created by means of the toASN1Object() method.

Specified by:
decode in interface ASN1Type
Parameters:
algorithmID - the AlgorithmID as ASN1Object
Throws:
CodingException - if the ASN1Object is no AlgorithmID

toASN1Object

public ASN1Object toASN1Object()
Returns the AlgorithmID as an (SEQUENCE) ASN1Object.
Specified by:
toASN1Object in interface ASN1Type
Returns:
the AlgorithmID as ASN1Object
See Also:
SEQUENCE

toASN1Object

public ASN1Object toASN1Object(boolean useNULLForAbsentParameters)
Returns the AlgorithmID as an (SEQUENCE) ASN1Object.
Parameters:
useNULLForAbsentParameters - whether to encode absent parameters as NULL or omit the parameters component
Returns:
the AlgorithmID as ASN1Object

getImplementationName

public String getImplementationName()
                             throws NoSuchAlgorithmException
Returns the name for an implementation of this algorithm.
Returns:
the name for an implementation e.g. "DES/CBC"
Throws:
NoSuchAlgorithmException - if there is no name for the implementation

getInstance

public Object getInstance()
                   throws NoSuchAlgorithmException
Tries to find an implementation for this AlgorithmIdentifier. This method calls the getInstance() methods in the following order:
Returns:
an instance of the object which implements this algorithm
Throws:
NoSuchAlgorithmException - if there is no implementation

getInstance

public Object getInstance(String provider)
                   throws NoSuchAlgorithmException
Tries to find a provider specific implementation for this AlgorithmIdentifier. This method calls the getInstance() methods in the following order:
Parameters:
provider - the name of the requested provider
Returns:
an instance of the object which implements this algorithm
Throws:
NoSuchAlgorithmException - if there is no implementation

getCipherInstance

public Cipher getCipherInstance()
                         throws NoSuchAlgorithmException
Tries to find a Cipher implementation for this AlgorithmIdentifier. This method calls Cipher.getInstance(algorithm) by substituting the algorithmID´s for the algorithm parameter in Cipher.getInstance(algorithm).
Returns:
an Cipher instance of the object which implements this algorithm
Throws:
NoSuchAlgorithmException - if there is no Cipher implementation

getCipherInstance

public Cipher getCipherInstance(String provider)
                         throws NoSuchAlgorithmException
Tries to find a provider-specific Cipher implementation for this AlgorithmIdentifier. This method calls Cipher.getInstance(algorithm, provider) by substituting the algorithmID´s for the algorithm parameter in Cipher.getInstance(algorithm, provider).
Parameters:
provider - the name of the requested provider
Returns:
an Cipher instance of the object which implements this algorithm
Throws:
NoSuchAlgorithmException - if there is no Cipher implementation

getSignatureInstance

public Signature getSignatureInstance()
                               throws NoSuchAlgorithmException
Tries to find a Signature implementation for this AlgorithmIdentifier. This method calls Signature.getInstance(algorithm) by substituting the algorithmID´s for the algorithm parameter in Signature.getInstance(algorithm).
Returns:
a Signature instance of the object which implements this algorithm
Throws:
NoSuchAlgorithmException - if there is no Signature implementation

getSignatureInstance

public Signature getSignatureInstance(String provider)
                               throws NoSuchAlgorithmException
Tries to find a provider-specific Signature implementation for this AlgorithmIdentifier. This method calls Signature.getInstance(algorithm,provider) by substituting the algorithmID´s for the algorithm parameter in Signature.getInstance(algorithm,provider).
Parameters:
provider - the name of the requested provider
Returns:
a Signature instance of the object which implements this algorithm
Throws:
NoSuchAlgorithmException - if there is no Signature implementation

getMessageDigestInstance

public MessageDigest getMessageDigestInstance()
                                       throws NoSuchAlgorithmException
Tries to find a MessageDigest implementation for this AlgorithmIdentifier. This method calls MessageDigest.getInstance(algorithm) by substituting the algorithmID´s for the algorithm parameter in MessageDigest.getInstance(algorithm).
Returns:
a MessageDigest instance of the object which implements this algorithm
Throws:
NoSuchAlgorithmException - if there is no MessageDigest implementation

getMessageDigestInstance

public MessageDigest getMessageDigestInstance(String provider)
                                       throws NoSuchAlgorithmException
Tries to find a provider-specific MessageDigest implementation for this AlgorithmIdentifier. This method calls MessageDigest.getInstance(algorithm,provider) by substituting the algorithmID´s for the algorithm parameter in MessageDigest.getInstance(algorithm,provider).
Parameters:
provider - the name of the requested provider
Returns:
a MessageDigest instance of the object which implements this algorithm
Throws:
NoSuchAlgorithmException - if there is no MessageDigest implementation

getMacInstance

public Mac getMacInstance()
                   throws NoSuchAlgorithmException
Tries to find a Mac implementation for this AlgorithmIdentifier. This method calls Mac.getInstance(algorithm) by substituting the algorithmID´s for the algorithm parameter in Mac.getInstance(algorithm).
Returns:
a Mac instance of the object which implements this algorithm
Throws:
NoSuchAlgorithmException - if there is no Mac implementation

getMacInstance

public Mac getMacInstance(String provider)
                   throws NoSuchAlgorithmException
Tries to find a provider-specific Mac implementation for this AlgorithmIdentifier. This method calls Mac.getInstance(algorithm,provider) by substituting the algorithmID´s for the algorithm parameter in Mac.getInstance(algorithm,provider).
Parameters:
provider - the name of the requested provider
Returns:
a Mac instance of the object which implements this algorithm
Throws:
NoSuchAlgorithmException - if there is no Mac implementation

getKeyAgreementInstance

public KeyAgreement getKeyAgreementInstance()
                                     throws NoSuchAlgorithmException
Tries to find a KeyAgreement implementation for this AlgorithmIdentifier. This method calls KeyAgreement.getInstance(algorithm) by substituting the algorithmID´s for the algorithm parameter in KeyAgreement.getInstance(algorithm).
Returns:
a KeyAgreement instance of the object which implements this algorithm
Throws:
NoSuchAlgorithmException - if there is no KeyAgreement implementation

getKeyAgreementInstance

public KeyAgreement getKeyAgreementInstance(String provider)
                                     throws NoSuchAlgorithmException
Tries to find a provider-specific KeyAgreement implementation for this AlgorithmIdentifier. This method calls KeyAgreement.getInstance(algorithm,provider) by substituting the algorithmID´s for the algorithm parameter in KeyAgreement.getInstance(algorithm,provider).
Parameters:
provider - the name of the requested provider
Returns:
a KeyAgreement instance of the object which implements this algorithm
Throws:
NoSuchAlgorithmException - if there is no KeyAgreement implementation

getKeyFactoryInstance

public KeyFactory getKeyFactoryInstance()
                                 throws NoSuchAlgorithmException
Tries to find a KeyFactory implementation for this AlgorithmIdentifier. This method calls KeyFactory.getInstance(algorithm) by substituting the algorithmID´s for the algorithm parameter in KeyFactory.getInstance(algorithm).
Returns:
a KeyFactory instance of the object which implements this algorithm
Throws:
NoSuchAlgorithmException - if there is no KeyFactory implementation

getKeyFactoryInstance

public KeyFactory getKeyFactoryInstance(String provider)
                                 throws NoSuchAlgorithmException
Tries to find a provider-specific KeyFactory implementation for this AlgorithmIdentifier. This method calls KeyFactory.getInstance(algorithm,provider) by substituting the algorithmID´s for the algorithm parameter in KeyFactory.getInstance(algorithm,provider).
Parameters:
provider - the name of the requested provider
Returns:
a KeyFactory instance of the object which implements this algorithm
Throws:
NoSuchAlgorithmException - if there is no KeyFactory implementation

getKeyPairGeneratorInstance

public KeyPairGenerator getKeyPairGeneratorInstance()
                                             throws NoSuchAlgorithmException
Tries to find a KeyPairGenerator implementation for this AlgorithmIdentifier. This method calls KeyPairGenerator.getInstance(algorithm) by substituting the algorithmID´s for the algorithm parameter in KeyPairGenerator.getInstance(algorithm).
Returns:
a KeyPairGenerator instance of the object which implements this algorithm
Throws:
NoSuchAlgorithmException - if there is no KeyPairGenerator implementation

getKeyPairGeneratorInstance

public KeyPairGenerator getKeyPairGeneratorInstance(String provider)
                                             throws NoSuchAlgorithmException
Tries to find a provider-specific KeyPairGenerator implementation for this AlgorithmID.

This method calls KeyPairGenerator.getInstance(algorithm,provider) by substituting the algorithmID´s

for the algorithm parameter in KeyPairGenerator.getInstance(algorithm,provider).
Parameters:
provider - the name of the requested provider
Returns:
a KeyPairGenerator instance of the object which implements this algorithm
Throws:
NoSuchAlgorithmException - if there is no KeyPairGenerator implementation

getKeyGeneratorInstance

public KeyGenerator getKeyGeneratorInstance()
                                     throws NoSuchAlgorithmException
Tries to find a KeyGenerator implementation for this AlgorithmIdentifier. This method calls KeyGenerator.getInstance(algorithm) by substituting the algorithmID´s for the algorithm parameter in KeyGenerator.getInstance(algorithm).
Returns:
a KeyGenerator instance of the object which implements this algorithm
Throws:
NoSuchAlgorithmException - if there is no KeyGenerator implementation

getKeyGeneratorInstance

public KeyGenerator getKeyGeneratorInstance(String provider)
                                     throws NoSuchAlgorithmException
Tries to find a provider-specific KeyGenerator implementation for this AlgorithmID.

This method calls KeyGenerator.getInstance(algorithm,provider) by substituting the algorithmID´s

for the algorithm parameter in KeyGenerator.getInstance(algorithm,provider).
Parameters:
provider - the name of the requested provider
Returns:
a KeyGenerator instance of the object which implements this algorithm
Throws:
NoSuchAlgorithmException - if there is no KeyGenerator implementation

getSecretKeyFactoryInstance

public SecretKeyFactory getSecretKeyFactoryInstance()
                                             throws NoSuchAlgorithmException
Tries to find a SecretKeyFactory implementation for this AlgorithmIdentifier. This method calls SecretKeyFactory.getInstance(algorithm) by substituting the algorithmID´s for the algorithm parameter in SecretKeyFactory.getInstance(algorithm).
Returns:
a SecretKeyFactory instance of the object which implements this algorithm
Throws:
NoSuchAlgorithmException - if there is no SecretKeyFactory implementation

getSecretKeyFactoryInstance

public SecretKeyFactory getSecretKeyFactoryInstance(String provider)
                                             throws NoSuchAlgorithmException
Tries to find a provider-specific SecretKeyFactory implementation for this AlgorithmID.

This method calls SecretKeyFactory.getInstance(algorithm,provider) by substituting the algorithmID´s

for the algorithm parameter in SecretKeyFactory.getInstance(algorithm,provider).
Parameters:
provider - the name of the requested provider
Returns:
a SecretKeyFactory instance of the object which implements this algorithm
Throws:
NoSuchAlgorithmException - if there is no SecretKeyFactory implementation

getMaskGenerationAlgorithmInstance

public MaskGenerationAlgorithm getMaskGenerationAlgorithmInstance()
                                                           throws NoSuchAlgorithmException
Tries to find an PKCS#1 MaskGenerationAlgorithm implementation for this AlgorithmIdentifier. Any parameter initialization has to be done by the calling application.
Returns:
a MaskGenerationAlgorithm instance of the object which implements this algorithm
Throws:
NoSuchAlgorithmException - if there is no MaskGenerationAlgorithm implementation available for this algorithm id

getMaskGenerationAlgorithmInstance

public MaskGenerationAlgorithm getMaskGenerationAlgorithmInstance(String provider)
                                                           throws NoSuchAlgorithmException
Tries to find an PKCS#1 MaskGenerationAlgorithm implementation for this AlgorithmIdentifier. Any parameter initialization has to be done by the calling application.
Parameters:
provider - the name of the requested provider
Returns:
a MaskGenerationAlgorithm instance of the object which implements this algorithm
Throws:
NoSuchAlgorithmException - if there is no MaskGenerationAlgorithm implementation available for this algorithm id

getRawImplementationName

public String getRawImplementationName()
                                throws NoSuchAlgorithmException
Tries to get the raw inplementation name of the algorithm this AlgorithmID represents.

In some situations (e.g. for instantiating a KeyGenerator,...) it might be useful to know the implementation name of the algorithm only and not whole the implemantation name which -- in the case of ciphers -- may represent the whole transformation string required when creating the corresponding Cipher object. The, for instance, implemantation name for DES-CBC may be "DES/CBC/PKC5Padding" which may be suitable for creating a Cipher object, but not for creating a key generator where only "DES" is required as returned by this method.

Returns:
the raw implementation name of the algorithm this AlgorithmID represents

clone

public Object clone()
Returns a clone of this AlgorithmID. Shall be used when setting an algorithm parameter to an already defined AlgorithmID (e.g. AlgorithmID.rsa).
Overrides:
clone in class Object
Returns:
a clone of this AlgorithmID

getAlgorithm

public ObjectID getAlgorithm()
Returns the ObjectID of the algorithm.
Returns:
the ObjectID of the algorithm
See Also:
ObjectID

getParameter

public ASN1Object getParameter()
Returns the parameters of the algorithm as ASN1Object.
Returns:
the parameters of the algorithm

getAlgorithmParameters

public AlgorithmParameters getAlgorithmParameters(String algorithm)
                                           throws NoSuchAlgorithmException
Returns the parameters of the algorithm as java.security.AlgorithmParameters object.
Parameters:
algorithm - the name of the algorithm the parameters belong to
Returns:
the parameter of the algorithm
Throws:
NoSuchAlgorithmException - if there are no parameters to return

getAlgorithmParameters

public AlgorithmParameters getAlgorithmParameters(String algorithm,
                                                  String provider)
                                           throws NoSuchAlgorithmException
Returns the parameters of the algorithm as java.security.AlgorithmParameters object.
Parameters:
algorithm - the name of the algorithm the parameters belong to
provider - the name of the cryptography provider from which the AlgorithmParameters object should be created
Returns:
the algorithm parameters
Throws:
NoSuchAlgorithmException - if there are no parameters to return

getAlgorithmParameters

public AlgorithmParameters getAlgorithmParameters()
                                           throws NoSuchAlgorithmException
Returns the parameters of the algorithm as java.security.AlgorithmParameters object.

In contrast to method getAlgorithmParameters(String algorithm) where the name used for instantiating the required AlgorithmParameters engine has to be supplied, this method tries to get the name from the raw implementation name.

Returns:
the algorithm parameters or null if no parameters are included
Throws:
NoSuchAlgorithmException - if there are no parameters to return

setAlgorithmParameters

public void setAlgorithmParameters(AlgorithmParameters parameters)
Sets the parameters of the algorithm. The parameters have to be specified as java.security.AlgorithmParameters object.
Parameters:
parameters - the parameters of the algorithm

setParameter

public void setParameter(ASN1Object parameters)
Sets the parameters of the algorithm. The parameters have to be specified as ASN1Object.
Parameters:
parameters - the parameters of the algorithm

getName

public String getName()
Returns the name registered for this AlgorithmID or the object identifier string if there is no name registered.
Returns:
the name of this AlgorithmID or the ObjectID string if no name is registered.

equals

public boolean equals(Object obj)
Compares this AlgorithmID with the given AlgorithmID.
Overrides:
equals in class Object
Parameters:
obj - the other AlgorithmID
Returns:
true, if the two AlgorithmIDs are equal, false otherwise

hashCode

public int hashCode()
Returns a hash code value for this object.
Overrides:
hashCode in class Object
Returns:
a hash code value for this object

toString

public String toString()
Returns a string that represents this AlgorithmIdentifier.
Overrides:
toString in class Object
Returns:
the string representation

This Javadoc may contain text parts from Internet Standard specifications (RFC 2459, 3280, 3039, 2560, 1521, 821, 822, 2253, 1319, 1321, ,2630, 2631, 2268, 3058, 2984, 2104, 2144, 2040, 2311, 2279, see copyright note) and RSA Data Security Public-Key Cryptography Standards (PKCS#1,3,5,7,8,9,10,12, see copyright note).

IAIK-JCE 3.1 with IAIK-JCE CC Core 3.1, (c) 1997-2004 IAIK