Public Member Functions | Static Public Attributes

de.softpro.doc.SignPKCS7 Interface Reference

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

List of all members.

Public Member Functions

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

Static Public Attributes

static final int ha_none = 0
 Hash algorithm: Invalid hash algorithm.
static final int ha_sha1 = 1
 Hash algorithm: SHA-1.
static final int ha_sha256 = 2
 Hash algorithm: SHA-256.
static final int ha_md5 = 3
 Hash algorithm: MD5.
static final int ha_sha384 = 4
 Hash algorithm: SHA-384.
static final int ha_sha512 = 5
 Hash algorithm: SHA-512.
static final int ha_ripemd160 = 6
 Hash algorithm: RIPEMD-160.
static final int ha_sha224 = 7
 Hash algorithm: SHA-224.

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 de.softpro.doc.SignPKCS7.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 de.softpro.doc.SignPKCS7.getSignatureSize ( boolean  aDetached,
int  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 signature: ha_md5, ha_sha1, ha_sha224, ha_sha256, ha_sha384, ha_sha512, or ha_ripemd160. This parameter also determines the size of encapsulated data (20 octets for ha_sha1) 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.
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.
See also:
ha_md5, ha_ripemd160, ha_sha1, ha_sha224, ha_sha256, ha_sha384, ha_sha512
String de.softpro.doc.SignPKCS7.getSubjectCommonName (  )

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

Returns:
The common name or null on error.
byte [] de.softpro.doc.SignPKCS7.sign ( Source  aSource,
boolean  aDetached,
int  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 signature: ha_md5, ha_sha1, ha_sha224, ha_sha256, ha_sha384, ha_sha512, or ha_ripemd160. 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.
[in]aTimeStamperNon-null to use a time-stamp server.
Returns:
The ASN.1-encoded PKCS #7 or CAdES signature or null on error.
See also:
ha_md5, ha_ripemd160, ha_sha1, ha_sha224, ha_sha256, ha_sha384, ha_sha512

Member Data Documentation

final int de.softpro.doc.SignPKCS7.ha_md5 = 3 [static]

Hash algorithm: MD5.

See also:
getSignatureSize(), sign()
final int de.softpro.doc.SignPKCS7.ha_none = 0 [static]

Hash algorithm: Invalid hash algorithm.

See also:
getSignatureSize(), sign()
final int de.softpro.doc.SignPKCS7.ha_ripemd160 = 6 [static]

Hash algorithm: RIPEMD-160.

See also:
getSignatureSize(), sign()
final int de.softpro.doc.SignPKCS7.ha_sha1 = 1 [static]

Hash algorithm: SHA-1.

See also:
getSignatureSize(), sign()
final int de.softpro.doc.SignPKCS7.ha_sha224 = 7 [static]

Hash algorithm: SHA-224.

See also:
getSignatureSize(), sign()
final int de.softpro.doc.SignPKCS7.ha_sha256 = 2 [static]

Hash algorithm: SHA-256.

See also:
getSignatureSize(), sign()
final int de.softpro.doc.SignPKCS7.ha_sha384 = 4 [static]

Hash algorithm: SHA-384.

See also:
getSignatureSize(), sign()
final int de.softpro.doc.SignPKCS7.ha_sha512 = 5 [static]

Hash algorithm: SHA-512.

See also:
getSignatureSize(), sign()

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