IAIK High-Level API
version 1.1

iaik.hlapi
Class XMLDecrypterVerifier

java.lang.Object
  extended by iaik.hlapi.DecrypterVerifier
      extended by iaik.hlapi.XMLDecrypterVerifier

public class XMLDecrypterVerifier
extends DecrypterVerifier

This class verifies XML signatures that were created using the XMLSignerEncrypter of this package or with software creating compatible XML signatures.

The current implementation does not support XML encryption.

The method process(InputStream) reads the provided XML signature first. It returns the signed content data as a stream. For best performance, the application should fully read the data from this stream before calling DecrypterVerifier.verify(CertValidator). Reading the stream after verification also works, but it is less efficient because this object may need to buffer the complete data internally.

Invariant

Constructor Summary
XMLDecrypterVerifier()
          Create a new XML signature verifier.
 
Method Summary
 void addSchemaURL(String schemaURL)
          Add the URL of an additional XML schema that the XML parser inside this object shall use when parsing XML documents.
 void dropDecryptionKeys()
          This method does nothing because decryption is unsupported.
 String getContentType()
          Get the content type (MIME type) of the signed data if the signed properties contain this information.
 Date getSigningTime()
          Get the signing time which was encoded as a signed property in the signature object.
 InputStream process(InputStream signature)
          Verify the given XML signature.
 void registerDecryptionKey(KeyAndCertificate decryptionKey)
          This method does nothing because decryption is unsupported.
 
Methods inherited from class iaik.hlapi.DecrypterVerifier
process, verify
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLDecrypterVerifier

public XMLDecrypterVerifier()
Create a new XML signature verifier.

Method Detail

registerDecryptionKey

public void registerDecryptionKey(KeyAndCertificate decryptionKey)
                           throws HlApiException
This method does nothing because decryption is unsupported.

Specified by:
registerDecryptionKey in class DecrypterVerifier
Parameters:
decryptionKey - The decryption key and the certificate.
Throws:
HlApiException - If handling the certificate fails.

dropDecryptionKeys

public void dropDecryptionKeys()
This method does nothing because decryption is unsupported.

Specified by:
dropDecryptionKeys in class DecrypterVerifier

getSigningTime

public Date getSigningTime()
Description copied from class: DecrypterVerifier
Get the signing time which was encoded as a signed property in the signature object.

Specified by:
getSigningTime in class DecrypterVerifier
Returns:
The signing time or null if there was no signing time encoded in the signed data or if there was no signature.

getContentType

public String getContentType()
Get the content type (MIME type) of the signed data if the signed properties contain this information.

Returns:
The MIME type or null if unavailable. For example text/html.

addSchemaURL

public void addSchemaURL(String schemaURL)
Add the URL of an additional XML schema that the XML parser inside this object shall use when parsing XML documents. It is required to specify additional schemas if documents contain e.g. ID attributes that are used for referencing XML elements.

Parameters:
schemaURL - The URL string of the XML schema document.
Preconditions
schemaURL != null

process

public InputStream process(InputStream signature)
                    throws IOException,
                           NoKeyException,
                           HlApiException
Verify the given XML signature.

The input stream is the XML document that contains the XML signature. This method selects the first dsig:Signature element for verification.

The returned data is the input to the hash computation, i.e. any transformations in the data reference are applied before the data is returned.

Specified by:
process in class DecrypterVerifier
Parameters:
signature - The stream that provides the encrypted and/or signed data.
Returns:
The decrypted/verified content data.
Throws:
IOException - If reading from the given stream fails.
NoKeyException - If there is no suitable key available for decryption.
HlApiException - If decryption or verification fails.

IAIK High-Level API
version 1.1

Copyright © 2007, IAIK, Graz University of Technology
Copyright © 2007, Stiftung SIC