Suleman Butt
2014-08-12 07:19:24 UTC
Hi Guys,
I am findign it difficult as to how I can create an SMIMEEnveloped object:
MimeBodyPart encryptedMimeBodyPart = new MimeBodyPart(
new
FileInputStream("C:/Temp/MSCONS_TL_9901068000001_4033871000202_20140730_000544422736-att/smime.p7m"));
SMIMEEnveloped enveloped = new
SMIMEEnveloped(encryptedMimeBodyPart);
On executing my second line, I get the following exception:
java.lang.NullPointerException
at org.bouncycastle.cms.CMSEnvelopedData.<init>(Unknown Source)
at org.bouncycastle.cms.CMSEnvelopedData.<init>(Unknown Source)
at org.bouncycastle.mail.smime.SMIMEEnveloped.<init>(Unknown Source)
at decryption_util.loadAlias(decryption_util.java:124)
at decryption_util.exportPrivateKey(decryption_util.java:89)
at decryption_util.main(decryption_util.java:62)
I have smime.p7m file (encrypted) on my machine, which I want to decrypt.
I have the complete certificate, which works fine when I load it on my
windows machine.
The certificate loading also works fine, in my opinion in my java program,
it just that it is unable to decrypt the smime part.
I am using bcpkix-jdk15on-151 and bcmail-jdk15on-151 as bouncy castle jars.
Any help in this regard shall be highlly appreciated.
Attached is the complete source file
Thanks.
I am findign it difficult as to how I can create an SMIMEEnveloped object:
MimeBodyPart encryptedMimeBodyPart = new MimeBodyPart(
new
FileInputStream("C:/Temp/MSCONS_TL_9901068000001_4033871000202_20140730_000544422736-att/smime.p7m"));
SMIMEEnveloped enveloped = new
SMIMEEnveloped(encryptedMimeBodyPart);
On executing my second line, I get the following exception:
java.lang.NullPointerException
at org.bouncycastle.cms.CMSEnvelopedData.<init>(Unknown Source)
at org.bouncycastle.cms.CMSEnvelopedData.<init>(Unknown Source)
at org.bouncycastle.mail.smime.SMIMEEnveloped.<init>(Unknown Source)
at decryption_util.loadAlias(decryption_util.java:124)
at decryption_util.exportPrivateKey(decryption_util.java:89)
at decryption_util.main(decryption_util.java:62)
I have smime.p7m file (encrypted) on my machine, which I want to decrypt.
I have the complete certificate, which works fine when I load it on my
windows machine.
The certificate loading also works fine, in my opinion in my java program,
it just that it is unable to decrypt the smime part.
I am using bcpkix-jdk15on-151 and bcmail-jdk15on-151 as bouncy castle jars.
Any help in this regard shall be highlly appreciated.
Attached is the complete source file
Thanks.