public class PKCS7CMSSignedDataDemo extends java.lang.Object
Constructor and Description |
---|
PKCS7CMSSignedDataDemo()
Setup the demo certificate chains.
|
Modifier and Type | Method and Description |
---|---|
iaik.asn1.ASN1Object |
createPKCS7SignedData(byte[] message,
int mode)
Creates a PKCS#7
SignedData object. |
byte[] |
createPKCS7SignedDataStream(byte[] message,
int mode)
Creates a PKCS#7
SignedData object. |
iaik.asn1.ASN1Object |
createSignedData(byte[] message,
int mode)
Creates a CMS
SignedData object. |
byte[] |
createSignedDataStream(byte[] message,
int mode)
Creates a CMS
SignedData object. |
byte[] |
getPKCS7SignedData(iaik.asn1.ASN1Object obj,
byte[] message)
Parses a PKCS#7
SignedData object and verifies the signatures
for all participated signers. |
byte[] |
getPKCS7SignedDataStream(byte[] signedData,
byte[] message)
Parses a PKCS#7
SignedData object and verifies the signatures
for all participated signers. |
byte[] |
getSignedData(iaik.asn1.ASN1Object obj,
byte[] message)
Parses a CMS or PKCS#7
SignedData object and verifies the signatures
for all participated signers. |
byte[] |
getSignedDataStream(byte[] signedData,
byte[] message)
Parses a CMS or PKCS#7
SignedData object and verifies the signatures
for all participated signers. |
static void |
main(java.lang.String[] argv)
Main method.
|
void |
start()
Tests the CMS SignedData implementation and checks it against the
IAIK PKCS#7 library.
|
public PKCS7CMSSignedDataDemo() throws java.io.IOException
java.io.IOException
- if an file read error occurspublic 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 transmission mode, either IMPLICIT or EXPLICITSignedData
object just creatediaik.cms.CMSException
- if the SignedData
object cannot
be createdjava.io.IOException
- if an I/O error occurspublic byte[] createPKCS7SignedDataStream(byte[] message, int mode) throws iaik.pkcs.PKCSException, java.io.IOException
SignedData
object.
message
- the message to be signed, as byte representationmode
- the transmission mode, either IMPLICIT or EXPLICITSignedData
object just creatediaik.pkcs.PKCSException
- if the SignedData
object cannot
be createdjava.io.IOException
- if an I/O error occurspublic byte[] getSignedDataStream(byte[] signedData, byte[] message) throws iaik.cms.CMSException, java.io.IOException
SignedData
object and verifies the signatures
for all participated signers.signedData
- SignedData
object as DER encoded byte arraymessage
- the the message which was transmitted out-of-band (explicit signed)iaik.cms.CMSException
- if any signature does not verifyjava.io.IOException
- if an I/O error occurspublic byte[] getPKCS7SignedDataStream(byte[] signedData, byte[] message) throws iaik.pkcs.PKCSException, java.io.IOException
SignedData
object and verifies the signatures
for all participated signers.signedData
- SignedData
object as DER encoded byte arraymessage
- the the message which was transmitted out-of-band (explicit signed)iaik.pkcs.PKCSException
- if any signature does not verifyjava.io.IOException
- if an I/O error occurspublic iaik.asn1.ASN1Object createSignedData(byte[] message, int mode) throws iaik.cms.CMSException, java.io.IOException
SignedData
object.
message
- the message to be signed, as byte representationmode
- the mode, either SignedData.IMPLICIT or SignedData.EXPLICITSignedData
object as ASN.1 objectiaik.cms.CMSException
- if the SignedData
object cannot
be createdjava.io.IOException
- if an I/O error occurspublic iaik.asn1.ASN1Object createPKCS7SignedData(byte[] message, int mode) throws iaik.pkcs.PKCSException, java.io.IOException
SignedData
object.
message
- the message to be signed, as byte representationmode
- the mode, either SignedData.IMPLICIT or SignedData.EXPLICITSignedData
object as ASN.1 objectiaik.pkcs.PKCSException
- if the SignedData
object cannot
be createdjava.io.IOException
- if an I/O error occurspublic byte[] getSignedData(iaik.asn1.ASN1Object obj, byte[] message) throws iaik.cms.CMSException, java.io.IOException
SignedData
object and verifies the signatures
for all participated signers.obj
- SignedData
object in ASN.1 representationmessage
- the the message which was transmitted out-of-band (explicit signed)iaik.cms.CMSException
- if any signature does not verifyjava.io.IOException
- if an I/O error occurspublic byte[] getPKCS7SignedData(iaik.asn1.ASN1Object obj, byte[] message) throws iaik.pkcs.PKCSException, java.io.IOException
SignedData
object and verifies the signatures
for all participated signers.obj
- SignedData
object in ASN.1 representationmessage
- the the message which was transmitted out-of-band (explicit signed)iaik.pkcs.PKCSException
- if any signature does not verifyjava.io.IOException
- if an I/O error occurspublic void start()
public static void main(java.lang.String[] argv) throws java.lang.Exception
java.io.IOException
- if an I/O error occurs when reading required keys
and certificates from filesjava.lang.Exception