codec.x509.extensions
Class CertHashExtension
java.lang.Object
|
+--java.util.AbstractCollection
|
+--java.util.AbstractList
|
+--java.util.ArrayList
|
+--codec.asn1.ASN1AbstractCollection
|
+--codec.asn1.ASN1Sequence
|
+--codec.x509.X509Extension
|
+--codec.x509.extensions.CertHashExtension
- All Implemented Interfaces:
- ASN1Collection, ASN1Type, Cloneable, Collection, Externalizable, List, Serializable, X509Extension
- public class CertHashExtension
- extends X509Extension
id-sigi-at-certHash OBJECT IDENTIFIER ::= { 1 3 36 8 3 13 }
certHash EXTENSION ::= {
SYNTAX CertHashSyntax
IDENTIFIED BY id-sigi-at-certHash
}
CertHashSyntax ::= SEQUENCE {
hashAlgorithm AlgorithmIdentifier,
certificateHash OCTET STRING
}
- Version:
- "$Id: CertHashExtension.java,v 1.1 2004/08/16 13:31:37 pebinger Exp $"
- Author:
- Volker Roth
- See Also:
- Serialized Form
| Methods inherited from class codec.x509.X509Extension |
decodeExtensionValue, getCriticalExtensionOIDs, getEncoded, getExtensionValue, getNonCriticalExtensionOIDs, getOID, getValue, hasUnsupportedCriticalExtension, isCritical, setCritical, setOID, setValue, toString, toString |
| Methods inherited from class codec.asn1.ASN1AbstractCollection |
checkConstraints, encode, getCollection, getConstraint, getTagClass, isExplicit, isOptional, isType, readExternal, setConstraint, setExplicit, setOptional, writeExternal |
| Methods inherited from class java.util.ArrayList |
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, removeRange, set, size, toArray, toArray, trimToSize |
| Methods inherited from interface java.util.Collection |
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
DEFAULT_HASH_ALG
public static final String DEFAULT_HASH_ALG
EXTENSION_OID
public static final String EXTENSION_OID
CertHashExtension
public CertHashExtension()
throws ASN1Exception,
CertificateEncodingException
- Creates an instance ready for decoding.
CertHashExtension
public CertHashExtension(X509Certificate cert)
throws ASN1Exception,
GeneralSecurityException
- Creates an instance with the hash of the given certificate. The hash is
computed with the default hash function
DEFAULT_HASH_ALG.
CertHashExtension
public CertHashExtension(X509Certificate cert,
String alg)
throws ASN1Exception,
GeneralSecurityException
- Creates an instance with a hash of the given certificate where the hash
is computed with the given hash algorithm.
- Throws:
NoSuchAlgorithmException - if the given algorithm is not available.CertificateEncodingException - if the given certificate cannot be encoded correctly.GeneralSecurityException - if there is another security related error condition.ASN1Exception - hardly ever, this exception must be declared basically
because it is declared in the constructor of the super
class.
CertHashExtension
public CertHashExtension(byte[] cert,
String alg)
throws ASN1Exception,
GeneralSecurityException
- Creates an instance with a hash of the given encoded certificate where
the hash is computed with the given hash algorithm.
- Throws:
NoSuchAlgorithmException - if the given algorithm is not available.GeneralSecurityException - if there is another security related error condition.ASN1Exception - hardly ever, this exception must be declared basically
because it is declared in the constructor of the super
class.
decode
public void decode(Decoder dec)
throws ASN1Exception,
IOException
- Description copied from class:
ASN1AbstractCollection
- Reads this collection from the given
Decoder. This type
is initialized with the decoded data. The components of the decoded
collection must match the components of this collection. If they do then
the components are also initialized with the decoded values. Otherwise an
exception is thrown.
- Overrides:
decode in class ASN1AbstractCollection
- Following copied from class:
codec.asn1.ASN1AbstractCollection
- Parameters:
dec - The decoder to read from.
getHashAlgorithmID
public AlgorithmIdentifier getHashAlgorithmID()
getHashAlgorithmName
public String getHashAlgorithmName()
verify
public boolean verify(X509Certificate cert)
throws NoSuchAlgorithmException,
CertificateEncodingException
- Returns:
true if the hash of the given certificate equals
the hash stored in this structure.
verify
public boolean verify(byte[] cert)
throws NoSuchAlgorithmException
- Returns:
true if the hash of the given certificate equals
the hash stored in this structure.
Copyright © Fraunhofer Gesellschaft. All Rights Reserved.