public class BiometricData extends java.lang.Object implements ASN1Type
BiometricData
type of the PKIX Qualified
Certificate Profile.
The BiometricData
is used for including biometric information
into a qualified certificate by means of the private
BiometricInfo
extension.
The biometric information is provided by a hash of a biometric template:
BiometricData ::= SEQUENCE { typeOfBiometricData TypeOfBiometricData, hashAlgorithm AlgorithmIdentifier, biometricDataHash OCTET STRING, sourceDataUri IA5String OPTIONAL }The biometric information corresponding to the included hash value is not supplied. However, an URI may be specified pointing to the location where the biometric information can be obtained.
TypeOfBiometricData ::= CHOICE { predefinedBiometricType PredefinedBiometricType, biometricDataOid OBJECT IDENTIFIER }For more information about the
PredefinedBiometricType ::= INTEGER { picture(0), handwritten-signature(1)} (picture|handwritten-signature)
BiometricData
type please refer
to the actual Qualified Certificate Profile draft.
This class provides two constructors for supplying the type of biometric
data: BiometricData(int predefinedBiometricType)
may be used when creating a BiometricData
object of predefined
type and BiometricData(ObjectID
biometricDataOid)
for creating a BiometricData
object where the
type is indicated by an object identifier. In the first case use the static
variables picture
respectively
handwritten_signature
for indicating the
desired predefined type, e.g.:
BiometricData biometricData = new BiometricData(BiometricData.picture);After having created a
BiometricData
object you may choose among
three ways for setting hash algorithm and biometric data hash. When calling
method setBiometricDataHash(AlgorithmID hashAlgorithm, String sourceDataUri)
a
connection is established to the given source data uri for obtaining the
biometric data to be hashed and subsequently setting the calculated biometric
data hash value, e.g. (please note that this method only may be used for HTTP
urls):
BiometricData biometricData = new BiometricData(BiometricData.picture); String sourceDaraUri = "http://jcewww.iaik.at/images/PE03257A.gif"; biometricData.setBiometricDataHash(AlgorithmID.sha, sourceDataUri);When using method
setBiometricDataHash(AlgorithmID hashAlgorithm, InputStream is)
the
biometric data is calculated over the data supplied from the input stream. An
applicatin using method setBiometricDataHash(AlgorithmID hashAlgorithm, byte[])
has to calculate the
biometric data hash by itself. In both cases method
setSourceDataUri
may be used to set the
optional source data uri field:
String sourceDataUri = ...; biometricData.setSourceDataUri(sourceDataUri);Use method
setBiometricDatas
for adding BiometricData objects to a
BiometricInfo
extension.
When verifying the biometric data hash(es) included in a qualified certificate an application may use one of the following two methods obtaining the data to be hashed from the inherent source data uri or from the given input stream, respectively:
Modifier and Type | Field and Description |
---|---|
static int |
handwritten_signature
The predefined biometric data type handwritten-signature.
|
static int |
picture
The predefined biometric data type picture.
|
Constructor and Description |
---|
BiometricData()
Empty default constructor.
|
BiometricData(ASN1Object obj)
Creates a
BiometricData object from an ASN1Object. |
BiometricData(int predefinedBiometricType)
Creates a BiometricData object from predefined biometric type.
|
BiometricData(ObjectID biometricDataOid)
Creates a BiometricData object from the given object identifier.
|
Modifier and Type | Method and Description |
---|---|
void |
decode(ASN1Object obj)
Decodes this
BiometricData from an ASN1Object. |
byte[] |
getBiometricDataHash()
Gets the biometric data hash value.
|
java.lang.String |
getBiometricDataHashAsString()
Gets a string representation of the biometric data hash value.
|
AlgorithmID |
getHashAlgorithm()
Gets the hash algorithm.
|
java.lang.String |
getSourceDataUri()
Gets source data uri.
|
ASN1Object |
getTypeOfBiometricData()
Gets the type of biometric data.
|
void |
setBiometricDataHash(AlgorithmID hashAlgorithm,
byte[] biometricDataHash)
Sets hash algorithm and hash value of this BiometricData object.
|
void |
setBiometricDataHash(AlgorithmID hashAlgorithm,
java.io.InputStream is)
Calculates and sets the biometric data hash over the data supplied from an
input stream.
|
void |
setBiometricDataHash(AlgorithmID hashAlgorithm,
java.lang.String sourceDataUri)
Sets hash algorithm and biometric data hash value calculated from the given
source data uri.
|
void |
setSourceDataUri(java.lang.String sourceDataUri)
Sets the optional sourceDataUri field of this BiometricData object.
|
ASN1Object |
toASN1Object()
Returns this BiometricData as ASN1Object.
|
java.lang.String |
toString()
Returns a string giving some information about this
BiometricData object. |
boolean |
verifyBiometricDataHash()
Verifies the biometric data hash.
|
boolean |
verifyBiometricDataHash(java.io.InputStream is)
Verifies the biometric data hash.
|
public static final int picture
public static final int handwritten_signature
public BiometricData()
public BiometricData(int predefinedBiometricType) throws java.lang.IllegalArgumentException
predefinedBiometricType
- the predefined biometric type (either 0 for picture or 1 for
handwritten-signature)java.lang.IllegalArgumentException
- if the given predefined biometric type is not 0 (picture) or 1
(handwritten-signature)public BiometricData(ObjectID biometricDataOid)
biometricDataOid
- the object identifier indicating the type of biometric datapublic BiometricData(ASN1Object obj) throws CodingException
BiometricData
object from an ASN1Object.
The given ASN1Object represents an already existing BiometricData that may
have been created by using method toASN1Object()
.
obj
- the BiometricData as ASN1ObjectX509ExtensionException
- if the BiometricData cannot be parsedCodingException
public void decode(ASN1Object obj) throws CodingException
BiometricData
from an ASN1Object.
The given ASN1Object represents an already existing BiometricData that may
have been created by using method toASN1Object()
.
decode
in interface ASN1Type
obj
- the BiometricData as ASN1ObjectX509ExtensionException
- if the BiometricData cannot be parsedCodingException
- if the ASN1Object could not be parsedpublic ASN1Object toASN1Object() throws CodingException
toASN1Object
in interface ASN1Type
CodingException
- if an de/encoding error occurspublic void setSourceDataUri(java.lang.String sourceDataUri)
sourceDataUri
field, if present, represents an URI that
points to a location where the biometric information corresponding to the
stored hash value can be found.sourceDataUri
- the source data URIpublic void setBiometricDataHash(AlgorithmID hashAlgorithm, byte[] biometricDataHash)
hashAlgorithm
- the hash algorithmbiometricDataHash
- the hash valuepublic void setBiometricDataHash(AlgorithmID hashAlgorithm, java.io.InputStream is) throws java.io.IOException, java.security.NoSuchAlgorithmException
hashAlgorithm
- the hash algorithm to be usedis
- the input stream from which to read the datajava.io.IOException
- if an error occurs while reading the datajava.security.NoSuchAlgorithmException
- if the requested hash algorithm is not supportedpublic void setBiometricDataHash(AlgorithmID hashAlgorithm, java.lang.String sourceDataUri) throws java.io.IOException, java.security.NoSuchAlgorithmException
This method tries to connect to the supplied (HTTP) source data uri to get the biometric data to be hashed. If successful, the given hash algorithm is used for calcuting and setting the biometric data hash value. Note that this method only may be used for HTTP urls.
If for some reason this method fails in setting the biometric data hash an
application may calculate the hash itself and may use method
setBiometricDataHash(AlgorithmID, byte[])
for explicitly setting the
biometric data hash value (or supply the data to be hashed from an input
stream and call method
setBiometricDataHash(AlgorithmID, InputStream)
for calculating and setting
the biometric data hash.
hashAlgorithm
- the hash algorithm to be usedsourceDataUri
- the (HTTP) URL from where to get the biometric data to be hashedjava.io.IOException
- if an error occurs when trying to get the dataNoSuchAlgorithm
- if the requested hash algorithm is not supportedjava.security.NoSuchAlgorithmException
public boolean verifyBiometricDataHash() throws java.io.IOException
If a source dara uri is included, this method tries to connect to it for getting the biometric data to be hashed. If successful a hash value is calculated over the data obatained and compared with the inherent biometric data hash. Note that this method only may be used for HTTP urls.
If for some reason this method fails in verifying the biometric data hash
an application may obtain the data and calculate a hash itself for
comparing it against the biometric data hash got by
getBiometricDataHash
(or use method
verifyBiometricDataHash(InputStream is)
for supplying the biometric data
to be hashed and verified from an input stream).
true
if the biometric data hash is ok,
false
otherwisejava.io.IOException
- if an error occurs when trying to get the data or computing
the hash to be verifiiedpublic boolean verifyBiometricDataHash(java.io.InputStream is) throws java.io.IOException
This method calculates a hash value over the data supplied from the given input stream and compares it against the inherent biometric data hash.
true
if the biometric data hash is ok,
false
otherwisejava.io.IOException
- if an error occurs when reading the data or computing the hash
to be verifiiedpublic ASN1Object getTypeOfBiometricData()
public AlgorithmID getHashAlgorithm()
public byte[] getBiometricDataHash()
public java.lang.String getBiometricDataHashAsString()
public java.lang.String getSourceDataUri()
public java.lang.String toString()
BiometricData
object.toString
in class java.lang.Object