FileDocCategorySizeDatePackage
AlgorithmIdentifier.javaAPI DocAndroid 1.5 API5686Wed May 06 22:41:06 BST 2009org.apache.harmony.security.x509

AlgorithmIdentifier

public class AlgorithmIdentifier extends Object
The class encapsulates the ASN.1 DER encoding/decoding work with the Algorithm Identifier which is a part of X.509 certificate (as specified in RFC 3280 - Internet X.509 Public Key Infrastructure. Certificate and Certificate Revocation List (CRL) Profile. http://www.ietf.org/rfc/rfc3280.txt):
AlgorithmIdentifier ::= SEQUENCE {
algorithm OBJECT IDENTIFIER,
parameters ANY DEFINED BY algorithm OPTIONAL
}

Fields Summary
private String
algorithm
private String
algorithmName
private byte[]
parameters
private byte[]
encoding
public static final org.apache.harmony.security.asn1.ASN1Sequence
ASN1
Custom AlgorithmIdentifier DER encoder/decoder
Constructors Summary
public AlgorithmIdentifier(String algorithm)
TODO

param
algorithm: String

        this(algorithm, null, null);
    
public AlgorithmIdentifier(String algorithm, byte[] parameters)
TODO

param
algorithm: String
param
parameters: byte[]

        this(algorithm, parameters, null);
    
private AlgorithmIdentifier(String algorithm, byte[] parameters, byte[] encoding)

        this.algorithm = algorithm;
        this.parameters = parameters;
        this.encoding = encoding;
    
Methods Summary
public voiddumpValue(java.lang.StringBuffer buffer)
Places the string representation into the StringBuffer object.

        buffer.append(getAlgorithmName());
        if (parameters == null) {
            buffer.append(", no params, "); //$NON-NLS-1$
        } else {
            buffer.append(", params unparsed, "); //$NON-NLS-1$
        }
        buffer.append("OID = "); //$NON-NLS-1$
        buffer.append(getAlgorithm());
    
public booleanequals(java.lang.Object ai)

        if (!(ai instanceof AlgorithmIdentifier)) {
            return false;
        }
        AlgorithmIdentifier algid = (AlgorithmIdentifier) ai;
        return (algorithm.equals(algid.algorithm))
            && ((parameters == null)
                    ? algid.parameters == null
                    : Arrays.equals(parameters, algid.parameters));
    
public java.lang.StringgetAlgorithm()
Returns the value of algorithm field of the structure.

return
algorithm

        return algorithm;
    
public java.lang.StringgetAlgorithmName()
Returns the name of the algorithm corresponding to its OID. If there is no the such correspondence, algorithm OID is returned.

return
algorithm

        if (algorithmName == null) {
            algorithmName = AlgNameMapper.map2AlgName(algorithm);
            if (algorithmName == null) {
                algorithmName = algorithm;
            }
        }
        return algorithmName;
    
public byte[]getEncoded()
Returns ASN.1 encoded form of this X.509 AlgorithmIdentifier value.

return
a byte array containing ASN.1 encode form.

        if (encoding == null) {
            encoding = ASN1.encode(this);
        }
        return encoding;
    
public byte[]getParameters()
Returns the value of parameters field of the structure.

return
parameters

        return parameters;