Subject: Error details
Good day to everyone:
Here is my code:
public class DecryptMessage {
public String filein, certfilepath , certpassw, certalias,messagecontent,errstring;
public void DecryptMimeMessage () {
try {
FileInputStream fileIn = new FileInputStream(filein);
File fin= new File (filein);
Properties props = System.getProperties();
props.put(“mail.host”, “”);
props.put(“mail.transport.protocol”, “smtp”);
Session mailSession = Session.getDefaultInstance(props, null);
MimeMessage message = new MimeMessage(mailSession, fileIn);
EncryptionUtils cryptoUtils = EncryptionManager.getEncryptionUtils(EncryptionManager.SMIME); // in this line i have error
EncryptionKeyManager keyMgr = cryptoUtils.createKeyManager();
char smimePw = new String( this.certpassw).toCharArray();
File _filepk12 = new File(certfilepath);
if (_filepk12 == null) {
this.errstring = “Не найден файл сертификата шифрования”;
if (fin.exists()){
fin.delete();
}
return;
};
keyMgr.loadPrivateKeystore(new FileInputStream(_filepk12), smimePw);
MimeMessage decryptedMsg = null;
Key privateKey = keyMgr.getPrivateKey(this.certalias, smimePw);
// try {
decryptedMsg = cryptoUtils.decryptMessage(null, message, privateKey);
// удаляем файл
if (fin.exists()){
fin.delete();
}
if (decryptedMsg!=null) {
this.messagecontent = decryptedMsg.getContent().toString();
} else {
this.errstring = “DecryptMessage is null”;
// удаляем файл
if (fin.exists()){
fin.delete();
}
return;
}
}catch (Exception err) {
File fin= new File (filein);
if (fin.exists()){
fin.delete();
};
this.errstring = err.toString();
err.printStackTrace();
};
}
}
The Error is:
java.security.NoSuchProviderException: No provider configured for S/MIME
at net.suberic.crypto.EncryptionManager.getEncryptionUtils(EncryptionManager.java:106)
at DecryptMessage.DecryptMimeMessage(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at lotus.domino.JavaConnectInvoker.invoke(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at lotus.domino.JavaConnectLoader.invoke(Unknown Source)
In lotus java.security file I registered bouncy castle provider:
security.provider.10=org.bouncycastle.jce.provider.BouncyCastleProvider
Can anybody helps me to solve this problem.