org.bouncycastle.cms.CMSStreamException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • db:: 4.20::PrivateKey Unknown key spec sm
    via by Unknown author,
  • Can't sign a dig sig utilizing java / keytool
    via Stack Overflow by Russ
    ,
    • org.bouncycastle.cms.CMSStreamException: key inappropriate for signature. at org.bouncycastle.cms.CMSSignedDataStreamGenerator$CmsSignedDataOutputStream.close(Unknown Source) at org.bouncycastle.mail.smime.SMIMESignedGenerator$ContentSigner.write(Unknown Source) at org.bouncycastle.mail.smime.handlers.PKCS7ContentHandler.writeTo(Unknown Source) at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:869) at javax.activation.DataHandler.writeTo(DataHandler.java:302) at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1383) at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:852) at org.bouncycastle.mail.smime.handlers.multipart_signed.outputBodyPart(Unknown Source) at org.bouncycastle.mail.smime.handlers.multipart_signed.outputBodyPart(Unknown Source) at org.bouncycastle.mail.smime.handlers.multipart_signed.writeTo(Unknown Source) at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:869) at javax.activation.DataHandler.writeTo(DataHandler.java:302) at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1383) at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1743) at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1719) at javaemail.SignedMultipartEmailTest.main(SignedMultipartEmailTest.java:537) Caused by: java.security.InvalidKeyException: Supplied key (sun.security.mscapi.RSAPrivateKey) is not a RSAPrivateKey instance at org.bouncycastle.jce.provider.JDKDigestSignature.engineInitSign(Unknown Source) at java.security.SignatureSpi.engineInitSign(SignatureSpi.java:86) at java.security.Signature$Delegate.engineInitSign(Signature.java:1104) at java.security.Signature.initSign(Signature.java:498) at org.bouncycastle.cms.CMSSignedDataStreamGenerator$SignerInf.toSignerInfo(Unknown Source) ... 16 more

    Users with the same issue

    Unknown visitor1 times, last one,