SignDoc SDK (Java)  5.0.0
SignPKCS7 Interface Reference

Interface for creating a PKCS #7 or CAdES signature. More...

Public Member Functions

byte[] sign (Source aSource, boolean aDetached, String aHashAlgorithm, TimeStamper aTimeStamper)
 Sign data, producing a PKCS #7 or CAdES signature. More...
 
int getSignatureSize (boolean aDetached, String aHashAlgorithm)
 Compute the size of the signature produced by sign(). More...
 
String getSubjectCommonName ()
 Get the common name (CN) of the certificate's subject. More...
 
String getErrorMessage ()
 Get an error message for the last operation. More...
 

Detailed Description

Interface for creating a PKCS #7 or CAdES signature.

Selection of the certificate, including intermediate certifcatse, and implementing CAdES is up to the implementation.

This interface is quite hard to use, please use interface SignRSA instead.

Member Function Documentation

String getErrorMessage ( )

Get an error message for the last operation.

After any method of this object has been called, this function shall return an error message (possibly empty if the most recently called method didn't fail).

Returns
An error message (possibly empty if the last operation succeeded).
int getSignatureSize ( boolean  aDetached,
String  aHashAlgorithm 
)

Compute the size of the signature produced by sign().

Parameters
[in]aDetachedtrue for a detached signature, false for an encapsulated signature.
[in]aHashAlgorithmHash algorithm to be used for the signature. This parameter also determines the size of encapsulated data (e.g., 20 octets for "SHA-1") if aDetached is false. You might want to ignore this value for ECDSA signatures as it might come from the DigestMethod seed value, which is to be used for RSA only. The following values are defined:
  • "MD5"
  • "RIPEMD-160"
  • "SHA-1"
  • "SHA-224"
  • "SHA-256"
  • "SHA-384"
  • "SHA-512"
Returns
A positive number which is an upper limit to the number of octets required for the ASN.1-encoded signature (excluding any RFC 3161 timestamp), zero on error.
String getSubjectCommonName ( )

Get the common name (CN) of the certificate's subject.

Returns
The common name or null on error.
byte [] sign ( Source  aSource,
boolean  aDetached,
String  aHashAlgorithm,
TimeStamper  aTimeStamper 
)

Sign data, producing a PKCS #7 or CAdES signature.

Parameters
[in]aSourceAn object providing data to be hashed and signed. If aDetached is false, all the data shall be encapsulated in the PKCS #7 message.
[in]aDetachedtrue for a detached signature, false for an encapsulated signature.
[in]aHashAlgorithmHash algorithm to be used for the signature. You might want to ignore this value for ECDSA signatures as it might come from the DigestMethod seed value, which is to be used for RSA only. The following values are defined:
  • "MD5"
  • "RIPEMD-160"
  • "SHA-1"
  • "SHA-224"
  • "SHA-256"
  • "SHA-384"
  • "SHA-512"
[in]aTimeStamperNon-null to use a time-stamp server.
Returns
The ASN.1-encoded PKCS #7 or CAdES signature or null on error.

The documentation for this interface was generated from the following file: