de.flexiprovider.pki
Class AlgorithmIdentifier
java.lang.Object
|
+--java.util.AbstractCollection
|
+--java.util.AbstractList
|
+--java.util.ArrayList
|
+--codec.asn1.ASN1AbstractCollection
|
+--codec.asn1.ASN1Sequence
|
+--codec.x509.AlgorithmIdentifier
|
+--de.flexiprovider.pki.AlgorithmIdentifier
- All Implemented Interfaces:
- codec.asn1.ASN1Collection, codec.asn1.ASN1Type, java.lang.Cloneable, java.util.Collection, java.io.Externalizable, java.util.List, java.io.Serializable
- public class AlgorithmIdentifier
- extends codec.x509.AlgorithmIdentifier
This class represents the ASN.1/DER value of the AlgorithmIdentifier defined
in Annex D to Recommendation X.509. This structure is extensively used for
instance in the PKCS standards of RSA Inc. The ASN.1 definition of this
structure is as given below:
AlgorithmIdentifier ::= SEQUENCE{
algorithm OBJECT IDENTIFIER,
parameters ANY DEFINED BY algorithm OPTIONAL
}
For this class to work properly, providers need to define the following
algorithm aliases for the AlgorithmParameters implementations they provide:
- AlgorithmParameters.MyAlg = class
- Alg.Alias.AlgorithmParameters.1.2.3.4 = MyAlg
- Alg.Alias.AlgorithmParameters.OID.1.2.3.4 = MyAlg
The first property defined the mapping of the JCE compliant standard name of
the algorithm to the implementing class. The second provider entry allows
mapping OID to those algorithm names while the third allows mapping those
names on corresponding OID.
The alias definitions are used by this class in order to find an
AlgorithmParameters implementation for the OID embedded in the X.509
AlgorithmIdentifier structure, and to create the OID for a given
AlgorithmParameters instances. This is done by means of the
JCA class, which operates on the engine and alias
definitions of the installed providers.
- Author:
- Volker Roth
- See Also:
codec.util.JCA, Serialized Form
| Fields inherited from class codec.x509.AlgorithmIdentifier |
algorithm_, parameters_ |
| Fields inherited from class java.util.AbstractList |
modCount |
|
Constructor Summary |
AlgorithmIdentifier()
This method builds the tree of ASN.1 objects used for decoding this
structure. |
AlgorithmIdentifier(codec.asn1.ASN1ObjectIdentifier oid,
codec.asn1.ASN1Type params)
Creates an instance with the given OID and parameters. |
AlgorithmIdentifier(codec.asn1.ASN1ObjectIdentifier oid,
byte[] b)
Creates an instance with the given OID and opaque algorithm parameter
representation. |
| Methods inherited from class codec.x509.AlgorithmIdentifier |
clone, createAlgorithmIdentifier, equals, getAlgorithmName, getAlgorithmOID, getParameters, hashCode, toString |
| Methods inherited from class codec.asn1.ASN1Sequence |
getTag |
| Methods inherited from class codec.asn1.ASN1AbstractCollection |
checkConstraints, decode, encode, getCollection, getConstraint, getTagClass, getValue, isExplicit, isOptional, isType, readExternal, setConstraint, setExplicit, setOptional, writeExternal |
| Methods inherited from class java.util.ArrayList |
add, add, addAll, addAll, clear, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, removeRange, set, size, toArray, toArray, trimToSize |
| Methods inherited from class java.util.AbstractList |
iterator, listIterator, listIterator, subList |
| Methods inherited from class java.util.AbstractCollection |
containsAll, remove, removeAll, retainAll |
| Methods inherited from class java.lang.Object |
, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Collection |
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
| Methods inherited from interface java.util.List |
containsAll, iterator, listIterator, listIterator, remove, removeAll, retainAll, subList |
AlgorithmIdentifier
public AlgorithmIdentifier()
- This method builds the tree of ASN.1 objects used for decoding this
structure.
AlgorithmIdentifier
public AlgorithmIdentifier(codec.asn1.ASN1ObjectIdentifier oid,
byte[] b)
throws codec.asn1.ASN1Exception
- Creates an instance with the given OID and opaque algorithm parameter
representation. Both the given OID and the parameter encoding is cloned
or copied. No side effects occur if these arguments are modified after
completion of this constructor.
- Parameters:
oid - The algorithm object identifier.b - The opaque DER encoding of the parameters for the
algorithm known under the given OID. If no parameters are
required then null might be passed. In that
case ASN.1NULL is encoded.- Throws:
codec.asn1.ASN1Exception - if the opaque representation does not contain a valid DER
header and contents octets.
AlgorithmIdentifier
public AlgorithmIdentifier(codec.asn1.ASN1ObjectIdentifier oid,
codec.asn1.ASN1Type params)
throws codec.asn1.ASN1Exception
- Creates an instance with the given OID and parameters. The parameters are
encoded according to DER and stored by means of an opaque type. If the
given parameters are null then an ASN.1 NULL is encoded.
- Parameters:
oid - The OID to use.params - The ASN.1 type of which the parameters consist.- Throws:
codec.asn1.ASN1Exception - if the given parameters cannot be encoded. This should
rarely happen.
getParams
public AlgorithmParameters getParams()
throws NoSuchAlgorithmException,
InvalidAlgorithmParameterException
- This method locates a suitable
AlgorithmParameters implementation
if it is available from the JCE compliant security providers that are
installed locally.
Such providers need to specify the following aliases for this to work:
- AlgorithmParameters.MyAlg = class
- Alg.Alias.AlgorithmParameters.1.2.3.4 = MyAlg
If you ever want to test a provider for compliance with the JCE and
cleverness, test it against the FhG-IGD PKCS package. If it
doesn't work then better demand fixes from the provider's vendor.
This method may be called only if this instance is initialised properly
either by specifying AlgorithmParameters in a constructor or by parsing a
valid ASN.1/DER encoding.
- Returns:
- The AlgorithmParameters or null if none are enclosed
in this structure.
- Throws:
NoSuchAlgorithmException - if no matching AlgorithmParameters engine is found.InvalidAlgorithmParameterException - if the parameters cannot be decoded properly.