Skip navigation links

Oracle Fusion Middleware Crypto Java API Reference for Oracle Security Developer Tools
11g Release 1 (11.1.1)

E10668-03


oracle.security.crypto.core
Class AlgorithmIdentifier

java.lang.Object
  extended by oracle.security.crypto.core.AlgorithmIdentifier

All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable, java.lang.Cloneable, ASN1Object, Streamable
Direct Known Subclasses:
CBCAlgorithmIdentifier, OAEPAlgorithmIdentifier, PBEAlgorithmIdentifier, PBMacAlgID, RC2AlgorithmIdentifier

public class AlgorithmIdentifier
extends java.lang.Object
implements ASN1Object, java.lang.Cloneable, java.io.Externalizable

This class encapsulates an AlgorithmIdentifier object, as defined in X.509 and as used in several other standards, such as PKCS.

Instances consist of an OID which identifies the algorithm, together with an optional parameters object, which can be any ASN.1 object.

Instances are considered equal if they have the same OID and parameters, with the provison that no distinction is made between the parameters being encoded as the ASN.1 NULL object and the parameters being omitted entirely.

See Also:
Serialized Form

Constructor Summary
AlgorithmIdentifier()
          Creates a new empty instance.
AlgorithmIdentifier(ASN1ObjectID oid)
          Creates a new algorithm identifier without parameters.
AlgorithmIdentifier(ASN1ObjectID oid, ASN1Object parameters)
          Creates a new algorithm identifier with the given algorithm OID and parameters.
AlgorithmIdentifier(ASN1ObjectID oid, boolean useNULL)
          Creates a new algorithm identifier with the given algorithm OID and no parameters.
AlgorithmIdentifier(ASN1Sequence s)
          Creates a new AlgorithmIdentifier object from the specified ASN1Sequence.
AlgorithmIdentifier(java.io.InputStream is)
          Creates a new AlgorithmIdentifier object from the specified input stream.

 

Method Summary
 java.lang.Object clone()
          Creates a deep copy of this AlgorithmIdentifier object.
 boolean equals(java.lang.Object o)
          Tests if the Object passed as a parameter is equal to this AlgorithmIdentifier object.
 ASN1ObjectID getOID()
          Returns the algorithm OID.
 ASN1Object getParameters()
          Returns the algorithm parameters, or null if they are not present.
 int hashCode()
          Returns the hash code value of this object.
 void input(java.io.InputStream is)
          Inputs this object from the specified input stream.
 int length()
          Length of this object's encoding.
 void output(java.io.OutputStream os)
          Outputs this object to the specified output stream.
 void readExternal(java.io.ObjectInput is)
          Reads the input stream and initializes the algorithm identifier.
 java.lang.String toString()
          Returns a representation of this algorithm identifier object.
 void writeExternal(java.io.ObjectOutput os)
          Writes to the output stream the DER encoding of this object.

 

Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait

 

Constructor Detail

AlgorithmIdentifier

public AlgorithmIdentifier(ASN1ObjectID oid,
                           ASN1Object parameters)
Creates a new algorithm identifier with the given algorithm OID and parameters.
Parameters:
oid - the OID which identifies the algorithm
parameters - the algorithm parameters

AlgorithmIdentifier

public AlgorithmIdentifier(ASN1ObjectID oid,
                           boolean useNULL)
Creates a new algorithm identifier with the given algorithm OID and no parameters. The flag indicates whether to omit the parameters altogether or insert an ASN.1 NULL object.
Parameters:
oid - the OID which identifies the algorithm
useNULL -

AlgorithmIdentifier

public AlgorithmIdentifier(ASN1ObjectID oid)
Creates a new algorithm identifier without parameters. An ASN.1 NULL type will be used for the parameters field.

AlgorithmIdentifier

public AlgorithmIdentifier(java.io.InputStream is)
                    throws java.io.IOException
Creates a new AlgorithmIdentifier object from the specified input stream.
Parameters:
is - The stream from which the algorithm identifier will be created.
Throws:
java.io.IOException

AlgorithmIdentifier

public AlgorithmIdentifier(ASN1Sequence s)
                    throws ASN1FormatException
Creates a new AlgorithmIdentifier object from the specified ASN1Sequence.
Parameters:
s - The ASN1Sequence from which the algorithm identifier will be created.
Throws:
ASN1FormatException

AlgorithmIdentifier

public AlgorithmIdentifier()
Creates a new empty instance. This constructor is to be used with serialization or with the input method.

Method Detail

getOID

public ASN1ObjectID getOID()
Returns the algorithm OID.

getParameters

public ASN1Object getParameters()
Returns the algorithm parameters, or null if they are not present.

equals

public boolean equals(java.lang.Object o)
Tests if the Object passed as a parameter is equal to this AlgorithmIdentifier object. The encoded representation of the algorithm identifiers will be compared.
Overrides:
equals in class java.lang.Object
Returns:
true if the objects are identical, false otherwise.

hashCode

public int hashCode()
Returns the hash code value of this object.
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Returns a representation of this algorithm identifier object.
Overrides:
toString in class java.lang.Object
Returns:
A String containing the OID and the parameters.

clone

public java.lang.Object clone()
Creates a deep copy of this AlgorithmIdentifier object.
Overrides:
clone in class java.lang.Object

input

public void input(java.io.InputStream is)
           throws java.io.IOException
Description copied from interface: Streamable
Inputs this object from the specified input stream.
Specified by:
input in interface Streamable
Throws:
java.io.IOException

output

public void output(java.io.OutputStream os)
            throws java.io.IOException
Description copied from interface: Streamable
Outputs this object to the specified output stream.
Specified by:
output in interface Streamable
Throws:
java.io.IOException

length

public int length()
Description copied from interface: Streamable
Length of this object's encoding.
Specified by:
length in interface Streamable

writeExternal

public void writeExternal(java.io.ObjectOutput os)
                   throws java.io.IOException
Writes to the output stream the DER encoding of this object.
Specified by:
writeExternal in interface java.io.Externalizable
Parameters:
os - The output stream to write the encoding to.
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput is)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Reads the input stream and initializes the algorithm identifier.
Specified by:
readExternal in interface java.io.Externalizable
Parameters:
is - The stream to read from.
Throws:
java.io.IOException
java.lang.ClassNotFoundException

Skip navigation links

Oracle Fusion Middleware Crypto Java API Reference for Oracle Security Developer Tools
11g Release 1 (11.1.1)

E10668-03


Copyright © 2005, 2011 , Oracle. All rights reserved.