Ничто из этого не помогло мне. В конце я вернулся к коду dotNet, который работал впервые.
class Script
{
static public void Main(string[] args)
{
if (args.Length < 3 || args.Contains("/?"))
{
MainHelp(args);
return;
}
string _infile = args[0],
_outfile = args[2];
string _password = args[1], _outpassword = (args.Length > 3) ? args[3] : "";
Console.WriteLine(String.Format("{0} -> {1} with ({2} -> {3})", _infile, _outfile, _password, _outpassword));
System.Security.Cryptography.X509Certificates.X509Certificate2 cert = null;
Console.WriteLine(String.Format("Load {0} with {2}", _infile, _outfile, _password, _outpassword));
cert = new System.Security.Cryptography.X509Certificates.X509Certificate2(_infile, _password, X509KeyStorageFlags.Exportable);
Console.WriteLine(String.Format("Export {1} with {3}", _infile, _outfile, _password, _outpassword));
System.IO.File.WriteAllBytes(_outfile, cert.Export(System.Security.Cryptography.X509Certificates.X509ContentType.Pfx, _outpassword));
Console.WriteLine(String.Format("Export complete", _infile, _outfile, _password, _outpassword));
}
static public void MainHelp(string[] args)
{
Console.WriteLine("Usage pfxremovepwd [inpfx] [inpwd] [outpfx] [optional outpwd]");
return;
}
}
./remove_pass_from_cert.sh YourCertName YourCertPass