|
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.SignedDataStreamDemoWithAdditionalSignerInfo
public class SignedDataStreamDemoWithAdditionalSignerInfo
This class demonstrates the usage of an SDSEncodeListener to add a new SignerInfo to an existing, parsed SignedDataStream object.
A SDSEncodeListener
allows an application to update
a SignedDataStream
during the encoding phase.
In some situations it may be useful to supply information to a SignedDataStream
actually during encoding is performed. When implementing an SignedDataStream
encode listener an application has the chance to update the SignedDataStream
at two points during the encoding process: AFTER the content data has been
processed and any digest has been calulated (= BEFORE any signature value
is computed) and AFTER the signature values have been calculated. When doing
so an application has to implement two abstract methods: beforeComputeSignature
and
afterComputeSignature
(of course, an application may implement any of the two methods in a
way to do actually nothing (if no functionality is required)).
This demo uses the IAIK-CMS DefaultSDSEncodeListener
for adding a new SignerInfo to an already existing SignedDataStream "on the fly".
SignedDataStream
,
SDSEncodeListener
Constructor Summary | |
---|---|
SignedDataStreamDemoWithAdditionalSignerInfo()
Constructor. |
Method Summary | |
---|---|
byte[] |
createSignedDataStream(byte[] message,
int mode)
Creates a CMS SignedData object. |
byte[] |
getSignedDataStream(byte[] signedData,
byte[] message,
boolean writeAgain)
Parses a CMS SignedData object and verifies the signatures
for all participated signers. |
static void |
main(java.lang.String[] argv)
The main method. |
void |
start()
Starts the test. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SignedDataStreamDemoWithAdditionalSignerInfo()
Method Detail |
---|
public byte[] createSignedDataStream(byte[] message, int mode) throws iaik.cms.CMSException, java.io.IOException
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.io.IOException
- if an I/O error occurspublic byte[] getSignedDataStream(byte[] signedData, byte[] message, boolean writeAgain) throws iaik.cms.CMSException, java.io.IOException, java.security.NoSuchAlgorithmException
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)writeAgain
- whether to use a SDSEncodeListener to add a SignerInfo
and encode the SignedData again
iaik.cms.CMSException
- if any signature does not verify
java.io.IOException
- if an I/O error occurs
java.security.NoSuchAlgorithmException
public 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 |
![]() |