|
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.ecc.ECDSASignedDataOutputStreamDemo
public class ECDSASignedDataOutputStreamDemo
This class demonstrates the IAIK-CMS SignedDataOutputStream implementation with the ECDSA (with SHA1, SHA224, SHA256, SHA384, SHA512, RIPEMD160) signature algorithm.
Any keys/certificates required for this demo are read from a keystore
file "cmsecc.keystore" located in your current working directory. If
the keystore file does not exist you can create it by running the
SetupCMSEccKeyStore
program.
Additionally to iaik_cms.jar
you also must have
iaik_jce_(full).jar
(IAIK-JCE,
https://sic.tech/products/core-crypto-toolkits/jca-jce/),
and iaik_eccelarate.jar
(IAIK-ECCelerateTM,
https://sic.tech/products/core-crypto-toolkits/eccelerate/)
in your classpath.
Constructor Summary | |
---|---|
ECDSASignedDataOutputStreamDemo()
Default Constructor. |
Method Summary | |
---|---|
byte[] |
createSignedDataStream(byte[] message,
int mode,
iaik.asn1.structures.AlgorithmID hashAlgorithm,
iaik.asn1.structures.AlgorithmID signatureAlgorithm,
java.security.PrivateKey signerKey,
iaik.x509.X509Certificate[] certificates)
Creates an ECDSA signed CMS SignedDataStream object and wraps it by a
CMS ContentInfoStream . |
byte[] |
getSignedDataStream(byte[] signedData,
byte[] message,
iaik.x509.X509Certificate[] certificates)
Parses a CMS ContentInfo object holding a SignedData
object and verifies the signature. |
static void |
main(java.lang.String[] argv)
Starts the demo. |
void |
runDemo(byte[] message,
iaik.asn1.structures.AlgorithmID hashAlgorithm,
iaik.asn1.structures.AlgorithmID signatureAlgorithm,
iaik.utils.KeyAndCertificate signerKeyAndCert)
Runs the signing - verifying demo. |
void |
start()
Tests the CMS SignedData implementation with the ECDSA signature algorithm and several hash algorithms. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ECDSASignedDataOutputStreamDemo() throws java.lang.Exception
java.lang.Exception
Method Detail |
---|
public byte[] createSignedDataStream(byte[] message, int mode, iaik.asn1.structures.AlgorithmID hashAlgorithm, iaik.asn1.structures.AlgorithmID signatureAlgorithm, java.security.PrivateKey signerKey, iaik.x509.X509Certificate[] certificates) throws iaik.cms.CMSException, java.io.IOException
SignedDataStream
object and wraps it by a
CMS ContentInfoStream
.
message
- the message to be signed, as byte representationmode
- the transmission mode, either IMPLICIT or EXPLICIThashAlgorithm
- the hash algorithm to be usedsignatureAlgorithm
- the signature algorithm to be usedsignerKey
- the private key of the signercertificates
- the certificate chain of the signer
ContentInfo
object just created
iaik.cms.CMSException
- if the SignedData
, ContentInfo
object cannot be created
java.io.IOException
- if an I/O related error occurspublic byte[] getSignedDataStream(byte[] signedData, byte[] message, iaik.x509.X509Certificate[] certificates) throws iaik.cms.CMSException, java.io.IOException
ContentInfo
object holding a SignedData
object and verifies the signature.
signedData
- the ContentInfo
holding the SignedData
object as BER encoded byte arraymessage
- the the message which was transmitted out-of-band (explicit signed)certificates
- the certificate of the signer (used for alternative signature verification)
iaik.cms.CMSException
- if any signature does not verify
java.io.IOException
- if an I/O related error occurspublic void runDemo(byte[] message, iaik.asn1.structures.AlgorithmID hashAlgorithm, iaik.asn1.structures.AlgorithmID signatureAlgorithm, iaik.utils.KeyAndCertificate signerKeyAndCert) throws java.lang.Exception
message
- the message to be signedhashAlgorithm
- the hash algorithm to be usedsignatureAlgorithm
- the signature algorithm to be usedsignerKeyAndCert
- private key and certificate chain of the signer
java.lang.Exception
public void start() throws java.lang.Exception
java.lang.Exception
public static void main(java.lang.String[] argv) throws java.lang.Exception
java.lang.Exception
- if an error occurs
|
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 |
![]() |