// Sebastien Pouliot <sebastien@ximian.com>
//
// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004,2006 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004,2006-2007 Novell, Inc (http://www.novell.com)
//
using System;
return null;
}
- PrivateKey pvk = PrivateKey.CreateFromFile (keyfile);
- if (pvk.Encrypted) {
+ try {
+ PrivateKey pvk = PrivateKey.CreateFromFile (keyfile);
+ rsa = pvk.RSA;
+ }
+ catch (CryptographicException) {
Console.WriteLine ("Enter password for {0}: ", keyfile);
string password = Console.ReadLine ();
- pvk = PrivateKey.CreateFromFile (keyfile, password);
- if (pvk.RSA == null)
+ try {
+ PrivateKey pvk = PrivateKey.CreateFromFile (keyfile, password);
+ rsa = pvk.RSA;
+ }
+ catch (CryptographicException) {
Console.WriteLine ("Invalid password!");
+ }
}
- rsa = pvk.RSA;
}
else {
rsa = new RSACryptoServiceProvider (csp);
string auth = args [i++].ToLower ();
switch (auth) {
case "individual":
- af.Authority = Authority.Commercial;
+ af.Authority = Authority.Individual;
break;
case "commercial":
- af.Authority = Authority.Individual;
+ af.Authority = Authority.Commercial;
break;
default:
Console.WriteLine ("Unknown authority {0}", auth);