[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AW: [iaik-jce] Constructing a signed S/Mime with signature and without private key


this feature is not supported by IAIK-S/MIME (i.e. you cannot include a
self-created SignedData or SMimeSigned object into a SignedConten object;
the SMimeSigned is created by class SignedContent itself).

Dieter Bratko

-----Ursprüngliche Nachricht-----
Von: iaik-jce-owner@iaik.tu-graz.ac.at
[mailto:iaik-jce-owner@iaik.tu-graz.ac.at]Im Auftrag von parti
Gesendet: Freitag, 23. Februar 2001 18:40
An: iaik-jce@iaik.tu-graz.ac.at
Betreff: [iaik-jce] Constructing a signed S/Mime with signature and
without private key


I'm working with smartcards, the SC stores the private key. I can get only
the signature and not the private key. I try to create an S/MIME message.

I have the SMimeSigned object created:

FileInputStream isCert = new FileInputStream ("certificate.cer");
X509Certificate cert = new X509Certificate (isCert);

X509Certificate[] certificates = new X509Certificate [1];
certificates [0] = cert;

FileInputStream isMsg = new FileInputStream ("msg.txt");

SMimeSigned signedData = new SMimeSigned (isMsg, SignedDataStream.IMPLICIT);
signedData.setCertificates (certificates);

IssuerAndSerialNumber issuer = new IssuerAndSerialNumber (cert);
SignerInfo signerInfo = new SignerInfo (issuer, AlgorithmID.sha1, null);

FileInputStream isSign = new FileInputStream ("signature.sig");
byte [] bufSign = new byte [isSign.available()];
isSign.read (bufSign);
signerInfo.setEncryptedDigest (bufSign);

signedData.addSignerInfo (signerInfo);

FileOutputStream osP7 = new FileOutputStream ("test.msg");
signedData.writeTo (osP7, 2048);

What is the next step? I don't see the connection to SignedContent or
MimeMessage object.

With kind regards,

Istvan Parti
Mailinglist-archive at

To unsubscribe send an email to listserv@iaik.at with the folowing content: