|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--iaik.asn1.structures.AlgorithmID
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!
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 |
protected static Hashtable implementations
protected static Hashtable algorithms
public static AlgorithmID dhKeyAgreement
Diffie-Hellman
key exchange algorithm.
AlgorithmID.dhKeyAgreement
.public static AlgorithmID esdhKeyAgreement
Ephemeral-Static Diffie-Hellman
key
agreement algorithm (RFC 2631).
AlgorithmID.esdhKeyAgreement
.public static AlgorithmID esdh
Ephemeral-Static
Diffie-Hellman
keys.
AlgorithmID.esdh
.public static AlgorithmID ssdhKeyAgreement
Static-Static Diffie-Hellman
key
agreement algorithm (CMS).
AlgorithmID.esdhKeyAgreement
.public static AlgorithmID rsaEncryption
RSA encryption
signature algorithm.
AlgorithmID.rsaEncryption
.public static AlgorithmID md2WithRSAEncryption
md2WithRSAEncryption
signature algorithm.
AlgorithmID.md2WithRSAEncryption
.public static AlgorithmID md4WithRSAEncryption
md4WithRSAEncryption
signature algorithm.
AlgorithmID.md4WithRSAEncryption
.public static AlgorithmID md5WithRSAEncryption
md5WithRSAEncryption
signature algorithm.
AlgorithmID.md5WithRSAEncryption
.public static AlgorithmID sha1WithRSAEncryption_
sha1WithRSAEncryption
signature algorithm.
AlgorithmID.sha1WithRSAEncryption_
.public static AlgorithmID sha1WithRSAEncryption
sha1WithRSAEncryption
signature algorithm.
AlgorithmID.sha1WithRSAEncryption
.public static AlgorithmID sha256WithRSAEncryption
sha256WithRSAEncryption
signature algorithm (PKCS#1v2).
AlgorithmID.sha256WithRSAEncryption
.public static AlgorithmID sha384WithRSAEncryption
sha384WithRSAEncryption
signature algorithm (PKCS#1v2).
AlgorithmID.sha384WithRSAEncryption
.public static AlgorithmID sha512WithRSAEncryption
sha512WithRSAEncryption
signature algorithm (PKCS#1v2).
AlgorithmID.sha512WithRSAEncryption
.public static AlgorithmID dsa_
DSA
algorithm (used with key factories).
AlgorithmID.dsa_
.public static AlgorithmID dsa
DSA
algorithm (used with KeyFactories).
AlgorithmID.dsa
.public static AlgorithmID dsa_With_SHA1
dsaWithSHA1
signature algorithm.
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!)
public static AlgorithmID dsaWithSHA
dsaWithSHA
signature algorithm
(addresses the same Signature engine as dsaWithSHA1).
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!)
public static AlgorithmID dsaWithSHA1
dsaWithSHA1
signature algorithm.
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!)
public static AlgorithmID ecdsa
ECDSA
algorithm (used with key factories).
AlgorithmID.ecdsa
.public static AlgorithmID ecdsa_With_SHA1
ecdsa-with-SHA1
signature algorithm.
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!)
public static AlgorithmID rsaSignatureWithRipemd160
rsaSignatureWithRipemd128
signature algorithm.
AlgorithmID.rsaSignatureWithRipemd160
.public static AlgorithmID rsaSignatureWithRipemd128
rsaSignatureWithRipemd128
signature algorithm.
AlgorithmID.rsaSignatureWithRipemd128
.public static AlgorithmID rsassaPss
RSASSA-PSS
signature
algorithm.
AlgorithmID.rsassaPss
.public static AlgorithmID mgf1
MGF1
mask generation
function.
AlgorithmID.sha1WithRSAEncryption
.public static AlgorithmID pbeWithMD5AndDES_CBC
pbeWithMD5AndDES_CBC
key-encryption algorithm
as defined by PKCS#5.
AlgorithmID.pbeWithMD5AndDES_CBC
.public static AlgorithmID pbeWithSHAAnd128BitRC4
pbeWithSHAAnd128BitRC4
key-encryption algorithm
as defined by PKCS#12.
AlgorithmID.pbeWithSHAAnd128BitRC4
.public static AlgorithmID pbeWithSHAAnd40BitRC4
pbeWithSHAAnd40BitRC4
key-encryption algorithm
as defined by PKCS#12.
AlgorithmID.pbeWithSHAAnd40BitRC4
.public static AlgorithmID pbeWithSHAAnd3_KeyTripleDES_CBC
pbeWithSHAAnd3_KeyTripleDES_CBC
key-encryption algorithm
as defined by PKCS#12.
AlgorithmID.pbeWithSHAAnd3_KeyTripleDES_CBC
.public static AlgorithmID pbeWithSHAAnd2_KeyTripleDES_CBC
pbeWithSHAAnd2_KeyTripleDES_CBC
key-encryption algorithm
as defined by PKCS#12.
AlgorithmID.pbeWithSHAAnd2_KeyTripleDES_CBC
.public static AlgorithmID pbeWithSHAAnd128BitRC2_CBC
pbeWithSHAAnd128BitRC2_CBC
key-encryption algorithm
as defined by PKCS#12.
AlgorithmID.pbeWithSHAAnd128BitRC2_CBC
.public static AlgorithmID pbeWithSHAAnd40BitRC2_CBC
pbeWithSHAAnd40BitRC2_CBC
key-encryption algorithm
as defined by PKCS#12.
AlgorithmID.pbeWithSHAAnd40BitRC2_CBC
.public static AlgorithmID pbkdf2
PBKDF2
key-derivation function
as defined by PKCS#5 ((key generator).
AlgorithmID.pbeWithSHAAnd40BitRC2_CBC
.public static AlgorithmID rsa
RSA
public key algorithm.
AlgorithmID.rsa
.public static AlgorithmID rsaesOAEP
RSAES-OAEP
encryption scheme.
AlgorithmID.rsaesOAEP
.public static AlgorithmID rc2_CBC
RC2
[TM] symmetric block cipher used in CBC mode.
AlgorithmID.rc2_CBC
.public static AlgorithmID arcfour
ARCFOUR
stream cipher.
AlgorithmID.arcfour
.public static AlgorithmID rc4
RC4
[TM] stream cipher.
AlgorithmID.rc4
.public static AlgorithmID des_EDE3_CBC
Triple DES
symmetric block cipher used in CBC mode.
AlgorithmID.des_EDE3_CBC
.public static AlgorithmID des_CBC
DES
symmetric block cipher used in CBC mode.
AlgorithmID.des_CBC
.public static AlgorithmID idea_CBC
IDEA
symmetric block cipher used in CBC mode.
AlgorithmID.des_CBC
.public static AlgorithmID aes128_CBC
AES-128
symmetric block cipher used in CBC mode.
AlgorithmID.des_CBC
.public static AlgorithmID aes192_CBC
AES-192
symmetric block cipher used in CBC mode.
AlgorithmID.des_CBC
.public static AlgorithmID aes256_CBC
AES-256
symmetric block cipher used in CBC mode.
AlgorithmID.des_CBC
.public static AlgorithmID cast5_CBC
CAST5
symmetric block cipher used in CBC mode.
AlgorithmID.cast5_CBC
.public static AlgorithmID rc5_CBC
RC5
[TM] symmetric block cipher used in CBC mode.
AlgorithmID.rc5_CBC
.public static AlgorithmID pSpecified
pSpecified
PSourceAlgorithm.
AlgorithmID.pSpecified
.public static AlgorithmID md2
MD2
message digest algorithm.
AlgorithmID.md2
.public static AlgorithmID md4
MD4
message digest algorithm.
AlgorithmID.md4
.public static AlgorithmID md5
MD5
message digest algorithm.
AlgorithmID.md5
.public static AlgorithmID sha
SHA
message digest algorithm.
AlgorithmID.sha
.public static AlgorithmID sha1
SHA1
message digest algorithm which is the same as SHA
.
AlgorithmID.sha1
.public static AlgorithmID sha256
SHA-256
message digest algorithm.
AlgorithmID.sha256
.public static AlgorithmID sha384
SHA-384
message digest algorithm.
AlgorithmID.sha256
.public static AlgorithmID sha512
SHA-384
message digest algorithm.
AlgorithmID.sha512
.public static AlgorithmID ripeMd160
RipeMd160
message digest algorithm.
AlgorithmID.ripeMd160
.public static AlgorithmID ripeMd128
RipeMd128
message digest algorithm.
AlgorithmID.ripeMd128
.public static AlgorithmID hMAC_MD5
hMAC-SHA1
message digest algorithm.
AlgorithmID.hMAC_MD5
.public static AlgorithmID hMAC_SHA1_
hMAC-SHA1
message digest algorithm.
AlgorithmID.hMAC_SHA1_
.public static AlgorithmID hMAC_SHA1
hMAC-SHA1
message digest algorithm.
AlgorithmID.hMAC_SHA1
.public static AlgorithmID hMAC_RIPEMD160
hMAC-RIPEMD160
message digest algorithm.
AlgorithmID.hMAC_RIPEMD160
.public static AlgorithmID cms_3DES_wrap
CMS3DESwrap
key wrap algorithm for
wrapping 3DES content encryption keys with 3DES key encryption keys (RFC 2630).
AlgorithmID.cms_3DES_wrap
.public static AlgorithmID cms_rc2_wrap
CMSRC2wrap
key wrap algorithm for
wrapping RC2 content encryption keys with RC2 key encryption keys (RFC 2630).
AlgorithmID.cms_rc2_wrap
.public static AlgorithmID cms_idea_wrap
CMSIDEAwrap
key wrap algorithm for
wrapping IDEA content encryption keys with IDEA key encryption keys (RFC 3058).
AlgorithmID.cms_3DES_wrap
.public static AlgorithmID cms_cast5_wrap
CMSCAST128wrap
key wrap algorithm for
wrapping CAST128 content encryption keys with CAST128 key encryption keys (RFC 2984).
AlgorithmID.cms_3DES_wrap
.Constructor Detail |
public AlgorithmID()
null
ObjectID and
null
parameters.public AlgorithmID(String objectID, String name)
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"public AlgorithmID(String objectID, String name, String implementationName)
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"public AlgorithmID(String objectID, String name, String implementationName, boolean useNULLForAbsentParameters)
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.
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 encodingpublic AlgorithmID(ObjectID algorithm)
algorithm
- the ObjectID of the algorithmpublic AlgorithmID(ObjectID algorithm, ASN1Object parameter)
algorithm
- the ObjectID of the algorithmparameter
- the algorithm parameterspublic AlgorithmID(ASN1Object algorithmID) throws CodingException
toASN1Object()
method.algorithmID
- the AlgorithmID as ASN1ObjectCodingException
- if the ASN1Object is no AlgorithmIDpublic AlgorithmID(DerInputStream is) throws IOException
The given DerInputStream
supplies
DER encoded data that represents an already existing AlgorithmID.
is
- the DerInputStream supplying the DER encoded ASN1ObjectIOException
- if an I/O or decoding error occursMethod Detail |
public static boolean changeObjectID(AlgorithmID algID, ObjectID oid)
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)
.algID
- the AlgorithmID to which a new OID shall be allocatedoid
- the new object identifierpublic static boolean changeOIDString(AlgorithmID algID, String oidString)
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)
.algID
- the AlgorithmID to which a new OID shall be allocatedoid
- the new object identifierpublic static void register(String objectID, String name, String implementationName)
AlgorithmID.register("1.3.14.3.2.12", "DSA", "DSA");as alternative to:
new AlgorithmID("1.3.14.3.2.12", "DSA", "DSA");
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"public static AlgorithmID getAlgorithmID(String implementationName)
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) { ... }
implementationName
- the implementation name (e.g. "3DES/CBC/PKCS5Padding")
for which a AlgorithmID shall be searchednull
if no AlgorithmID for this implementation name is registeredpublic void encodeAbsentParametersAsNull(boolean useNULLForAbsentParameters)
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.
useNULLForAbsentParameters
- true
if absent parameters
shall be encoded as NULL, false
if absent parameters
shall be omitted from the encodingpublic void decode(ASN1Object algorithmID) throws CodingException
The supplied ASN1Object represents an already existing AlgorithmID that may
have been created by means of the toASN1Object()
method.
decode
in interface ASN1Type
algorithmID
- the AlgorithmID as ASN1ObjectCodingException
- if the ASN1Object is no AlgorithmIDpublic ASN1Object toASN1Object()
toASN1Object
in interface ASN1Type
SEQUENCE
public ASN1Object toASN1Object(boolean useNULLForAbsentParameters)
useNULLForAbsentParameters
- whether to encode absent parameters
as NULL or omit the parameters componentpublic String getImplementationName() throws NoSuchAlgorithmException
NoSuchAlgorithmException
- if there is no name for the implementationpublic Object getInstance() throws NoSuchAlgorithmException
NoSuchAlgorithmException
- if there is no implementationpublic Object getInstance(String provider) throws NoSuchAlgorithmException
provider
- the name of the requested providerNoSuchAlgorithmException
- if there is no implementationpublic Cipher getCipherInstance() throws NoSuchAlgorithmException
NoSuchAlgorithmException
- if there is no Cipher implementationpublic Cipher getCipherInstance(String provider) throws NoSuchAlgorithmException
provider
- the name of the requested providerNoSuchAlgorithmException
- if there is no Cipher implementationpublic Signature getSignatureInstance() throws NoSuchAlgorithmException
NoSuchAlgorithmException
- if there is no Signature implementationpublic Signature getSignatureInstance(String provider) throws NoSuchAlgorithmException
provider
- the name of the requested providerNoSuchAlgorithmException
- if there is no Signature implementationpublic MessageDigest getMessageDigestInstance() throws NoSuchAlgorithmException
NoSuchAlgorithmException
- if there is no MessageDigest implementationpublic MessageDigest getMessageDigestInstance(String provider) throws NoSuchAlgorithmException
provider
- the name of the requested providerNoSuchAlgorithmException
- if there is no MessageDigest implementationpublic Mac getMacInstance() throws NoSuchAlgorithmException
NoSuchAlgorithmException
- if there is no Mac implementationpublic Mac getMacInstance(String provider) throws NoSuchAlgorithmException
provider
- the name of the requested providerNoSuchAlgorithmException
- if there is no Mac implementationpublic KeyAgreement getKeyAgreementInstance() throws NoSuchAlgorithmException
NoSuchAlgorithmException
- if there is no KeyAgreement implementationpublic KeyAgreement getKeyAgreementInstance(String provider) throws NoSuchAlgorithmException
provider
- the name of the requested providerNoSuchAlgorithmException
- if there is no KeyAgreement implementationpublic KeyFactory getKeyFactoryInstance() throws NoSuchAlgorithmException
NoSuchAlgorithmException
- if there is no KeyFactory implementationpublic KeyFactory getKeyFactoryInstance(String provider) throws NoSuchAlgorithmException
provider
- the name of the requested providerNoSuchAlgorithmException
- if there is no KeyFactory implementationpublic KeyPairGenerator getKeyPairGeneratorInstance() throws NoSuchAlgorithmException
NoSuchAlgorithmException
- if there is no KeyPairGenerator implementationpublic KeyPairGenerator getKeyPairGeneratorInstance(String provider) throws NoSuchAlgorithmException
This method calls KeyPairGenerator.getInstance(algorithm,provider) by substituting the algorithmID´s
provider
- the name of the requested providerNoSuchAlgorithmException
- if there is no KeyPairGenerator implementationpublic KeyGenerator getKeyGeneratorInstance() throws NoSuchAlgorithmException
NoSuchAlgorithmException
- if there is no KeyGenerator implementationpublic KeyGenerator getKeyGeneratorInstance(String provider) throws NoSuchAlgorithmException
This method calls KeyGenerator.getInstance(algorithm,provider) by substituting the algorithmID´s
provider
- the name of the requested providerNoSuchAlgorithmException
- if there is no KeyGenerator implementationpublic SecretKeyFactory getSecretKeyFactoryInstance() throws NoSuchAlgorithmException
NoSuchAlgorithmException
- if there is no SecretKeyFactory implementationpublic SecretKeyFactory getSecretKeyFactoryInstance(String provider) throws NoSuchAlgorithmException
This method calls SecretKeyFactory.getInstance(algorithm,provider) by substituting the algorithmID´s
provider
- the name of the requested providerNoSuchAlgorithmException
- if there is no SecretKeyFactory implementationpublic MaskGenerationAlgorithm getMaskGenerationAlgorithmInstance() throws NoSuchAlgorithmException
NoSuchAlgorithmException
- if there is no MaskGenerationAlgorithm implementation available
for this algorithm idpublic MaskGenerationAlgorithm getMaskGenerationAlgorithmInstance(String provider) throws NoSuchAlgorithmException
provider
- the name of the requested providerNoSuchAlgorithmException
- if there is no MaskGenerationAlgorithm implementation available
for this algorithm idpublic String getRawImplementationName() throws NoSuchAlgorithmException
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.
public Object clone()
clone
in class Object
public ObjectID getAlgorithm()
ObjectID
public ASN1Object getParameter()
public AlgorithmParameters getAlgorithmParameters(String algorithm) throws NoSuchAlgorithmException
java.security.AlgorithmParameters
object.algorithm
- the name of the algorithm the parameters belong toNoSuchAlgorithmException
- if there are no parameters to returnpublic AlgorithmParameters getAlgorithmParameters(String algorithm, String provider) throws NoSuchAlgorithmException
java.security.AlgorithmParameters
object.algorithm
- the name of the algorithm the parameters belong toprovider
- the name of the cryptography provider from which the
AlgorithmParameters object should be createdNoSuchAlgorithmException
- if there are no parameters to returnpublic AlgorithmParameters getAlgorithmParameters() throws NoSuchAlgorithmException
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.
null
if no parameters are includedNoSuchAlgorithmException
- if there are no parameters to returnpublic void setAlgorithmParameters(AlgorithmParameters parameters)
java.security.AlgorithmParameters
object.parameters
- the parameters of the algorithmpublic void setParameter(ASN1Object parameters)
parameters
- the parameters of the algorithmpublic String getName()
public boolean equals(Object obj)
equals
in class Object
obj
- the other AlgorithmIDtrue
, if the two AlgorithmIDs are equal, false
otherwisepublic int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
|
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). | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |