Ron Lu wrote:
> Hi,
> i tried to use the methode exec from the Class Runtime to run certutil in 
> java. The function of listing all certificates in a certain db(-L -d C:\test) 
> works well. However, i cannot add any cert to the db, although it works when 
> i do this from the command-line.
> My code looks as follows:
>               String cmdadd = "C:/nss3_10/certutil.exe " + 
>               "–A –n nickName" + 
>               " –t \"c,c,c\"" + 
>               " –i " + "C:/cert_test/certName.der" +
>               " -d " + "C:/cert_test";
> Process p = Runtime.getRuntime().exec(cmdadd);

You probably want to use JSS and use the importCertToPerm method of the 
CryptoManager class.

http://www.mozilla.org/projects/security/pki/jss/
http://www.mozilla.org/projects/security/pki/jss/javadoc/org/mozilla/jss/CryptoManager.html#importCertToPerm(org.mozilla.jss.crypto.X509Certificate,%20java.lang.String)

If you *really* want to continue doing it the way you are, I've had 
better experience passing in the command as an array of Strings rather 
than as one big string.

Dave
_______________________________________________
dev-tech-crypto mailing list
dev-tech-crypto@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-crypto

Reply via email to