All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class w3c.www.dsig.ResInfoExtension

java.lang.Object
   |
   +----w3c.www.dsig.ResInfoExtension

public class ResInfoExtension
extends Object
ResInfo as defined by W3C Digital Signature Initative. The ResInfo (resource information) is a PICS-1.1 extension that contains zero or more cryptographic hashes of the document the label references. Hashes are stored in the resinfo as name value pairs where name is a URL identifying the message digest algorithm and the value is the base64 encoded hash as defined in the respective hash algorithm specification. Optionally, each hash can contain the date it was created.

This class implements this set of message digests and also supports calculating and verifying hashes.

Example:

  extension
    ( optional "http://www.w3.org/TR/1998/REC-DSig-label/resinfo-1_0"
       ( "http://www.w3.org/TR/1998/REC-DSig-label/SHA1" "base64-hash" )
       ( "http://www.w3.org/TR/1998/REC-DSig-label/MD5" "base64-hash"
         "1997.02.05T08:15-0500" ) )
 


Variable Index

 o EXTENSION_ID
The name of the extension identifier (http://www.w3.org/TR/1998/REC-DSig-label/resinfo-1_0).

Constructor Index

 o ResInfoExtension()
Create an empty resource information

Method Index

 o addDigest(String, DSigLabelInterface, ISODate)
Calculate the message digest of the data referenced by the URL specified in the 'for' option of the label.
 o addDigest(String, InputStream, ISODate)
Calculate the message digest of the data from the InputStream ins and add it to the resinfo.
 o addDigest(String, String, ISODate)
Add the pre-computed message digest val for the algorithm alg.
 o containsDigest(String)
Check if a message digest for the given algorithm exists in this resinfo.
 o digests()
Enumerate the digest URLs.
 o getDigestDate(String)
Get the ISODate of a digest function.
 o getDigestValue(String)
Get the value of a digest function.
 o parse(Vector)
Parse a Vector to a ResInfo extension.
 o removeDigest(String)
Remove the message digest for the algorithm alg.
 o size()
Return the number of hashes in this ResInfo.
 o toString()
Return an S-Expression string representation of this ResInfo extension.
 o toVector()
Return a normalized, Vector form of ResInfo Extension.
 o verify(DSigLabelInterface)
Perform verification using the default policy as defined by the user.
 o verify(InputStream)
Perform verification using the default policy as defined by the user.
 o verify(String, DSigLabelInterface)
Verify if the hash of the document specified in the 'for' option of the label matches the hash stored in this resinfo.
 o verify(String, InputStream)
Verify if the hash of the data in the InputStream ins equals the hash stored in this resinfo.
 o verifyAll(DSigLabelInterface)
Verify if all hashes in the ResInfo extension match the document specified in the 'for' option of the label.
 o verifyAll(InputStream)
Verify if all hashes in the ResInfo extension match the data from the InputStream.

Variables

 o EXTENSION_ID
 public static final String EXTENSION_ID
The name of the extension identifier (http://www.w3.org/TR/1998/REC-DSig-label/resinfo-1_0).

Constructors

 o ResInfoExtension
 public ResInfoExtension()
Create an empty resource information

Methods

 o addDigest
 public void addDigest(String alg,
                       String val,
                       ISODate date)
Add the pre-computed message digest val for the algorithm alg. The digest val needs to be in the correct base 64 encoded format. If date is not null it is added as the digest's date.

 o addDigest
 public void addDigest(String alg,
                       InputStream ins,
                       ISODate date) throws NoSuchAlgorithmException, IOException
Calculate the message digest of the data from the InputStream ins and add it to the resinfo. If date is not null it is added as the digest's date.

Throws: NoSuchAlgorithmException
if the corresponding message digest algorithm cannot be found
Throws: IOException
if the input stream cannot be properly read.
 o addDigest
 public void addDigest(String alg,
                       DSigLabelInterface label,
                       ISODate date) throws NoSuchAlgorithmException, IOException, DSigException
Calculate the message digest of the data referenced by the URL specified in the 'for' option of the label. If date is not null it is added as the digest's date.

Throws: NoSuchAlgorithmException
if the corresponding message digest algorithm cannot be found
Throws: IOException
if it cannot open a URL stream.
Throws: DSigException
if there is no 'for' option in the label (i.e. the label does not specify which URL to perform digest).
 o verify
 public Trivalue verify(DSigLabelInterface label)
Perform verification using the default policy as defined by the user. However, this is not yet implemented and the method is equivalent to verify(label).

 o verify
 public Trivalue verify(InputStream ins)
Perform verification using the default policy as defined by the user. However, this is not yet implemented and the method is equivalent to verifyAll(ins).

 o verify
 public Trivalue verify(String alg,
                        DSigLabelInterface label)
Verify if the hash of the document specified in the 'for' option of the label matches the hash stored in this resinfo.

 o verify
 public Trivalue verify(String alg,
                        InputStream ins)
Verify if the hash of the data in the InputStream ins equals the hash stored in this resinfo.

 o verifyAll
 public Trivalue verifyAll(DSigLabelInterface label)
Verify if all hashes in the ResInfo extension match the document specified in the 'for' option of the label.

 o verifyAll
 public Trivalue verifyAll(InputStream ins)
Verify if all hashes in the ResInfo extension match the data from the InputStream. Hashing is done in parallel in a single scan of the InputStream so there is no need to reset or reopen the inputstream.

 o removeDigest
 public boolean removeDigest(String alg)
Remove the message digest for the algorithm alg. Return true if successful, false otherwise (no message digest for algorithm alg present).

 o containsDigest
 public boolean containsDigest(String alg)
Check if a message digest for the given algorithm exists in this resinfo.

 o size
 public int size()
Return the number of hashes in this ResInfo.

 o digests
 public Enumeration digests()
Enumerate the digest URLs.

 o getDigestValue
 public String getDigestValue(String alg)
Get the value of a digest function. Return null if not found. Applications should not need to use this, it is intended for internal use.

 o getDigestDate
 public ISODate getDigestDate(String alg)
Get the ISODate of a digest function. Return null if the algorithm is not found or no date is present.

 o parse
 public void parse(Vector v)
Parse a Vector to a ResInfo extension.

 o toVector
 public Vector toVector()
Return a normalized, Vector form of ResInfo Extension.

 o toString
 public String toString()
Return an S-Expression string representation of this ResInfo extension.

Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index