DigiStamp.com

dgs.tlkt.demo
Class VerifySignature

java.lang.Object
  extended bydgs.tlkt.demo.VerifySignature

public class VerifySignature
extends java.lang.Object

Verify that the time stamp for a particular file is authentic.

This source code is include with the SecureTime toolkit distribution.

This includes calculating the file's hash and using the public key certificate to verify the signature

Verify the signature using the RSA capabilities delivered with the VM.


Field Summary
 java.io.PrintStream myOut
          where should the output go.
 boolean verbose
          detailed output ?
 
Constructor Summary
VerifySignature()
          Create a processing instance.
VerifySignature(boolean verbose, java.io.PrintStream myOut)
           
 
Method Summary
 java.security.cert.X509Certificate findCertInFile(CMSTsToken cms)
           
static void main(java.lang.String[] args)
           
 java.security.cert.X509Certificate verifySignature(CMSTsToken cms)
          Verify the signature using the RSA capabilities delivered with the VM.
 java.security.cert.X509Certificate verifySignature(java.lang.String timestampedFile, CMSTsToken timeStamp)
          Demonstrate the core steps in verifying the time stamp token.
 java.security.cert.X509Certificate verifyTSofFile(java.lang.String timestampedFile, java.lang.String timestamp)
          Give a file that was time stamped and a time stamp.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myOut

public java.io.PrintStream myOut
where should the output go. Default is "System.out".


verbose

public boolean verbose
detailed output ? default = false

Constructor Detail

VerifySignature

public VerifySignature()
Create a processing instance.

See Also:
verifySignature(String, CMSTsToken)

VerifySignature

public VerifySignature(boolean verbose,
                       java.io.PrintStream myOut)
Parameters:
verbose -
myOut -
Method Detail

findCertInFile

public java.security.cert.X509Certificate findCertInFile(CMSTsToken cms)
                                                  throws ExceptionDgsEncode,
                                                         java.security.cert.CertificateException,
                                                         java.io.FileNotFoundException
Throws:
ExceptionDgsEncode
java.security.cert.CertificateException
java.io.FileNotFoundException

main

public static void main(java.lang.String[] args)

verifySignature

public java.security.cert.X509Certificate verifySignature(CMSTsToken cms)
                                                   throws java.security.NoSuchAlgorithmException,
                                                          ExceptionDgsEncode,
                                                          java.security.cert.CertificateException,
                                                          java.io.FileNotFoundException,
                                                          java.security.InvalidKeyException,
                                                          java.security.SignatureException
Verify the signature using the RSA capabilities delivered with the VM.

    Steps:
  1. find the public key based on its identifier
  2. check the signature of signed attributes

If the verify process is successful then it returns the x509 certificate that was used. Otherwise, returns null.

Throws:
java.security.NoSuchAlgorithmException
ExceptionDgsEncode
java.security.cert.CertificateException
java.io.FileNotFoundException
java.security.InvalidKeyException
java.security.SignatureException

verifySignature

public java.security.cert.X509Certificate verifySignature(java.lang.String timestampedFile,
                                                          CMSTsToken timeStamp)
                                                   throws java.security.InvalidKeyException,
                                                          ExceptionDgsEncode,
                                                          java.security.cert.CertificateException,
                                                          java.security.SignatureException,
                                                          java.security.NoSuchAlgorithmException,
                                                          java.io.IOException
Demonstrate the core steps in verifying the time stamp token. Verify the signature using the RSA capabilities delivered with the VM.

    Steps:
  1. check that the hash of the data is in TSTInfo
  2. check that the hash of TSTInfo is in signedAttibutes
  3. find the public key based on its identifier
  4. check the signature of signed attributes
If the verify process is successful then it returns the x509 certificate that was used. Otherwise, returns null.

Parameters:
timestampedFile - - file name of the data that was time stamped
timeStamp - - the time stamp object
Throws:
java.security.InvalidKeyException
ExceptionDgsEncode
java.security.cert.CertificateException
java.security.SignatureException
java.security.NoSuchAlgorithmException
java.io.IOException

verifyTSofFile

public java.security.cert.X509Certificate verifyTSofFile(java.lang.String timestampedFile,
                                                         java.lang.String timestamp)
                                                  throws java.security.InvalidKeyException,
                                                         java.security.cert.CertificateException,
                                                         java.security.SignatureException,
                                                         java.security.NoSuchAlgorithmException,
                                                         java.io.IOException
Give a file that was time stamped and a time stamp. Is the time stamp valid for that file.

If the verify process is successful then it returns the x509 certificate that was used. Otherwise, returns null.

Parameters:
timestampedFile - - file name of the data that was time stamped
timestamp - - file name where the time stamp is stored
Returns:
X509Certificate
Throws:
java.security.InvalidKeyException
java.security.cert.CertificateException
java.security.SignatureException
java.security.NoSuchAlgorithmException
java.io.IOException
See Also:
for more details

Copyright 2000-2010 DigiStamp, Inc.