|
IAIK CMS/SMIME Toolkit Demo API Documentation
Version 6.1 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdemo.cms.signedData.CounterSignatureDemo
public class CounterSignatureDemo
This class demonstrates the usage of the CounterSignature attribute.
A CounterSignature
attribute may be included
as an unsigned attribute into a SignerInfo
for counter signing
(signing in serial) the signature value of a SignerInfo included in a SignedData. The value
of a CounterSignature attribute itself is a SignerInfo.
This demo shows how a CounterSignature attribute may be added to some SignerInfo that belongs
to a SignedData object just parsed/verified. This class demonstrates adding/verifying of a
CounterSignature attribute to both the stream
and the
non-stream
implementations of the SignedData type. Since when
parsing an implicit -- where the content is included -- SignedData object, SignerInfos
can not accessed before the data has been processed, adding a counter signature to
a SignedDataStream
may require a different proceeding
than adding it to a SignedData
object. For that reason a
CounterSignatureListener
is used for the
stream demos to listen on and add the counter signature during the encoding process.
CounterSignatureListener
,
CounterSignature
,
SDSEncodeListener
,
SignedDataStream
,
SignerInfo
Constructor Summary | |
---|---|
CounterSignatureDemo()
Constructor. |
Method Summary | |
---|---|
byte[] |
createSignedData(byte[] message,
int mode)
Creates a CMS SignedData object. |
byte[] |
createSignedDataStream(byte[] message,
int mode)
Creates a CMS SignedData object. |
byte[] |
getSignedData(byte[] signedData,
byte[] message,
boolean counterSign)
Parses a CMS SignedData object and verifies the signatures
for all participated signers. |
byte[] |
getSignedDataStream(byte[] signedData,
byte[] message,
boolean counterSign)
Parses a CMS SignedData object and verifies the signatures
for all participated signers. |
static void |
main(java.lang.String[] argv)
Main method. |
void |
start()
Starts the demo. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CounterSignatureDemo()
Method Detail |
---|
public byte[] createSignedDataStream(byte[] message, int mode) throws java.lang.Exception
SignedData
object.
message
- the message to be signed, as byte representationmode
- the mode indicating whether to include the content
(SignedDataStream.IMPLICIT) or not (SignedDataStream.EXPLICIT)
SignedData
object just created
java.lang.Exception
- if the SignedData
object cannot
be created for some reasonpublic byte[] getSignedDataStream(byte[] signedData, byte[] message, boolean counterSign) throws java.lang.Exception
SignedData
object and verifies the signatures
for all participated signers.
signedData
- the SignedData, as BER encoded byte arraymessage
- the the message which was transmitted out-of-band (explicit signed)counterSign
- whether to use a SDSEncodeListener to add a SignerInfo
and encode the SignedData again
java.lang.Exception
- if an error occurspublic byte[] createSignedData(byte[] message, int mode) throws java.lang.Exception
SignedData
object.
message
- the message to be signed, as byte representationmode
- the mode indicating whether to include the content
(SignedDataStream.IMPLICIT) or not (SignedDataStream.EXPLICIT)
SignedData
object just created
iaik.cms.CMSException
- if the SignedData
object cannot
be created
java.lang.Exception
- if an error occurspublic byte[] getSignedData(byte[] signedData, byte[] message, boolean counterSign) throws java.lang.Exception
SignedData
object and verifies the signatures
for all participated signers.
signedData
- the SignedData, as BER encoded byte arraymessage
- the the message which was transmitted out-of-band (explicit signed)counterSign
- whether to use a SDSEncodeListener to add a SignerInfo
and encode the SignedData again
java.lang.Exception
- if any error occurspublic void start()
public static void main(java.lang.String[] argv) throws java.io.IOException
java.io.IOException
- if an I/O error occurs when reading required keys
and certificates from files
|
IAIK CMS/SMIME Toolkit Demo API Documentation
Version 6.1 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
![]() |
v6.1 (c) 2002 IAIK, (c) 2003 - 2025 SIC |
![]() |