|
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.ECDSASignedDataDemo
public class ECDSASignedDataDemo
This class demonstrates the IAIK-CMS SignedData(Stream) 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 | |
|---|---|
ECDSASignedDataDemo()
Default Constructor. |
|
| Method Summary | |
|---|---|
byte[] |
createSignedData(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 SignedData object and wraps it by a CMS
ContentInfo object. |
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[] |
getSignedData(byte[] signedData,
byte[] message,
iaik.x509.X509Certificate[] certificates)
Parses a CMS ContentInfo holding a SignedData
object and verifies the signature. |
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 ECDSASignedDataDemo()
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 occurs
public 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 occurs
public byte[] createSignedData(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
SignedData object and wraps it by a CMS
ContentInfo object.
message - the message to be signed, as byte representationmode - the mode, either SignedData.IMPLICIT or SignedData.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
SignedData-ContentInfo object
iaik.cms.CMSException - if the SignedData-ContentInfo object cannot
be created
java.io.IOException - if an I/O related error occurs
public byte[] getSignedData(byte[] signedData,
byte[] message,
iaik.x509.X509Certificate[] certificates)
throws iaik.cms.CMSException,
java.io.IOException
ContentInfo holding a SignedData
object and verifies the signature.
signedData - the ContentInfo holding the SignedData
object as DER encoded byte arraymessage - 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 occurs
public 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 |
|