AlgorithmId

This class identifies algorithms, such as cryptographic transforms, each of which may be associated with parameters. Instances of this base class are used when this runtime environment has no special knowledge of the algorithm type, and may also be used in other cases. Equivalence is defined according to OID and (where relevant) parameters.

<P>Subclasses may be used, for example when when the algorithm ID has associated parameters which some code (e.g. code using keys) needs to have parsed. Two examples of such algorithms are Diffie-Hellman key exchange, and the Digital Signature Standard Algorithm (DSS/DSA).

<P>The OID constants defined in this class correspond to some widely used algorithms, for which conventional string names have been defined. This class is not a general repository for OIDs, or for such string names. Note that the mappings between algorithm IDs and algorithm names is not one-to-one.

More...
class AlgorithmId : DerEncoder {}

Constructors

this
this(ObjectIdentifier oid)

Constructs a parameterless algorithm ID.

this
this(ObjectIdentifier oid, AlgorithmParameters algparams)

Constructs an algorithm ID with algorithm parameters.

Members

Functions

decodeParams
void decodeParams()
Undocumented in source. Be warned that the author may not have intended to support it.
derEncode
void derEncode(OutputStream outputStream)

DER encode this object onto an output stream. Implements the <code>DerEncoder</code> interface.

encode
void encode(DerOutputStream o)

Marshal a DER-encoded "AlgorithmID" sequence on the DER stream.

encode
byte[] encode()

Returns the DER-encoded X.509 AlgorithmId as a byte array.

equals
bool equals(AlgorithmId other)

Returns true iff the argument indicates the same algorithm with the same parameters.

equals
bool equals(ObjectIdentifier id)

Compares two algorithm IDs for equality. Returns true iff they are the same algorithm, ignoring algorithm parameters.

getEncodedParams
byte[] getEncodedParams()

Returns the DER encoded parameter, which can then be used to initialize java.security.AlgorithmParamters.

getName
string getName()

Returns a name for the algorithm which may be more intelligible to humans than the algorithm's OID, but which won't necessarily be comprehensible on other systems. For example, this might return a name such as "MD5withRSA" for a signature algorithm on some systems. It also returns names like "OID.1.2.3.4", when no particular name for the algorithm is known.

getOID
ObjectIdentifier getOID()

Returns the ISO OID for this algorithm. This is usually converted to a string and used as part of an algorithm name, for example "OID.1.3.14.3.2.13" style notation. Use the <code>getName</code> call when you do not need to ensure cross-system portability of algorithm names, or need a user friendly name.

getParameters
AlgorithmParameters getParameters()
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(Object other)

Compares this AlgorithmID to another. If algorithm parameters are available, they are compared. Otherwise, just the object IDs for the algorithm are compared.

paramsToString
string paramsToString()

Provides a human-readable description of the algorithm parameters. This may be redefined by subclasses which parse those parameters.

toHash
size_t toHash()

Returns a hashcode for this AlgorithmId.

toString
string toString()

Returns a string describing the algorithm and its parameters.

Static functions

get
AlgorithmId get(string algname)

Returns one of the algorithm IDs most commonly associated with this algorithm name.

get
AlgorithmId get(AlgorithmParameters algparams)

Returns one of the algorithm IDs most commonly associated with this algorithm parameters.

getDigAlgFromSigAlg
string getDigAlgFromSigAlg(string signatureAlgorithm)

* Extracts the digest algorithm name from a signature * algorithm name.

getEncAlgFromSigAlg
string getEncAlgFromSigAlg(string signatureAlgorithm)

* Extracts the encryption algorithm name from a signature * algorithm name.

makeSigAlg
string makeSigAlg(string digAlg, string encAlg)

Creates a signature algorithm name from a digest algorithm name and a encryption algorithm name.

parse
AlgorithmId parse(DerValue val)

Parse (unmarshal) an ID from a DER sequence input value. This form parsing might be used when expanding a value which has already been partially unmarshaled as a set or sequence member.

Static variables

AES_oid
ObjectIdentifier AES_oid;
Undocumented in source.
DH_PKIX_oid
ObjectIdentifier DH_PKIX_oid;
Undocumented in source.
DH_oid
ObjectIdentifier DH_oid;
Undocumented in source.
DSA_OIW_oid
ObjectIdentifier DSA_OIW_oid;
Undocumented in source.
DSA_oid
ObjectIdentifier DSA_oid;
Undocumented in source.
ECDH_oid
ObjectIdentifier ECDH_oid;
Undocumented in source.
EC_oid
ObjectIdentifier EC_oid;
Undocumented in source.
MD2_oid
ObjectIdentifier MD2_oid;

Algorithm ID for the MD2 Message Digest Algorthm, from RFC 1319. OID = 1.2.840.113549.2.2

MD5_oid
ObjectIdentifier MD5_oid;

Algorithm ID for the MD5 Message Digest Algorthm, from RFC 1321. OID = 1.2.840.113549.2.5

RSAEncryption_oid
ObjectIdentifier RSAEncryption_oid;
Undocumented in source.
RSA_oid
ObjectIdentifier RSA_oid;
Undocumented in source.
SHA224_oid
ObjectIdentifier SHA224_oid;
Undocumented in source.
SHA256_oid
ObjectIdentifier SHA256_oid;
Undocumented in source.
SHA384_oid
ObjectIdentifier SHA384_oid;
Undocumented in source.
SHA512_oid
ObjectIdentifier SHA512_oid;
Undocumented in source.
SHA_oid
ObjectIdentifier SHA_oid;

Algorithm ID for the SHA1 Message Digest Algorithm, from FIPS 180-1. This is sometimes called "SHA", though that is often confusing since many people refer to FIPS 180 (which has an error) as defining SHA. OID = 1.3.14.3.2.26. Old SHA-0 OID: 1.3.14.3.2.18.

md2WithRSAEncryption_oid
ObjectIdentifier md2WithRSAEncryption_oid;
Undocumented in source.
md5WithRSAEncryption_oid
ObjectIdentifier md5WithRSAEncryption_oid;
Undocumented in source.
pbeWithMD5AndDES_oid
ObjectIdentifier pbeWithMD5AndDES_oid;

Algorithm ID for the PBE encryption algorithms from PKCS#5 and PKCS#12.

pbeWithMD5AndRC2_oid
ObjectIdentifier pbeWithMD5AndRC2_oid;
Undocumented in source.
pbeWithSHA1AndDES_oid
ObjectIdentifier pbeWithSHA1AndDES_oid;
Undocumented in source.
pbeWithSHA1AndDESede_oid
ObjectIdentifier pbeWithSHA1AndDESede_oid;
Undocumented in source.
pbeWithSHA1AndRC2_40_oid
ObjectIdentifier pbeWithSHA1AndRC2_40_oid;
Undocumented in source.
pbeWithSHA1AndRC2_oid
ObjectIdentifier pbeWithSHA1AndRC2_oid;
Undocumented in source.
sha1WithDSA_OIW_oid
ObjectIdentifier sha1WithDSA_OIW_oid;
Undocumented in source.
sha1WithDSA_oid
ObjectIdentifier sha1WithDSA_oid;
Undocumented in source.
sha1WithECDSA_oid
ObjectIdentifier sha1WithECDSA_oid;
Undocumented in source.
sha1WithRSAEncryption_OIW_oid
ObjectIdentifier sha1WithRSAEncryption_OIW_oid;
Undocumented in source.
sha1WithRSAEncryption_oid
ObjectIdentifier sha1WithRSAEncryption_oid;
Undocumented in source.
sha224WithDSA_oid
ObjectIdentifier sha224WithDSA_oid;
Undocumented in source.
sha224WithECDSA_oid
ObjectIdentifier sha224WithECDSA_oid;
Undocumented in source.
sha224WithRSAEncryption_oid
ObjectIdentifier sha224WithRSAEncryption_oid;
Undocumented in source.
sha256WithDSA_oid
ObjectIdentifier sha256WithDSA_oid;
Undocumented in source.
sha256WithECDSA_oid
ObjectIdentifier sha256WithECDSA_oid;
Undocumented in source.
sha256WithRSAEncryption_oid
ObjectIdentifier sha256WithRSAEncryption_oid;
Undocumented in source.
sha384WithECDSA_oid
ObjectIdentifier sha384WithECDSA_oid;
Undocumented in source.
sha384WithRSAEncryption_oid
ObjectIdentifier sha384WithRSAEncryption_oid;
Undocumented in source.
sha512WithECDSA_oid
ObjectIdentifier sha512WithECDSA_oid;
Undocumented in source.
sha512WithRSAEncryption_oid
ObjectIdentifier sha512WithRSAEncryption_oid;
Undocumented in source.
shaWithDSA_OIW_oid
ObjectIdentifier shaWithDSA_OIW_oid;
Undocumented in source.
specifiedWithECDSA_oid
ObjectIdentifier specifiedWithECDSA_oid;
Undocumented in source.

Variables

params
DerValue params;

Parameters for this algorithm. These are stored in unparsed DER-encoded form; subclasses can be made to automaticaly parse them so there is fast access to these parameters.

Inherited Members

From DerEncoder

derEncode
void derEncode(OutputStream ot)

DER encode this object and write the results to a stream.

Detailed Description

@author David Brownell @author Amit Kapoor @author Hemma Prafullchandra

Meta