Author: spouliot
Date: 2005-04-24 10:57:52 -0400 (Sun, 24 Apr 2005)
New Revision: 43512
Modified:
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/ChangeLog
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509CertificateEx.cs
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509CertificateExCollection.cs
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509EnhancedKeyUsageExtension.cs
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509KeyUsageExtension.cs
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509KeyUsageFlags.cs
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509NameType.cs
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509Store.cs
Log:
2005-04-24 Sebastien Pouliot <[EMAIL PROTECTED]>
* X509CertificateEx.cs: Added new constructors and Import methods that
accept SecureString for passwords. Added new property HasPrivateKey and
Verify method.
* X509CertificateExCollection.cs: Added new constructor that accept a
single X509Certificate2.
* X509EnhancedKeyUsageExtension.cs: Fixed compiler warnings.
* X509KeyUsageExtension.cs: Fixed new enum name for CrlSign.
* X509KeyUsageFlags.cs: Fixed values and removed [Serializable].
* X509NameType.cs: Fixed values and removed [Serializable].
* X509Store.cs: Added new constructor that accept an IntPtr and the
StoreHandle property. Fixed compiler warnings.
Modified:
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/ChangeLog
===================================================================
---
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/ChangeLog
2005-04-24 09:57:50 UTC (rev 43511)
+++
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/ChangeLog
2005-04-24 14:57:52 UTC (rev 43512)
@@ -1,3 +1,17 @@
+2005-04-24 Sebastien Pouliot <[EMAIL PROTECTED]>
+
+ * X509CertificateEx.cs: Added new constructors and Import methods that
+ accept SecureString for passwords. Added new property HasPrivateKey and
+ Verify method.
+ * X509CertificateExCollection.cs: Added new constructor that accept a
+ single X509Certificate2.
+ * X509EnhancedKeyUsageExtension.cs: Fixed compiler warnings.
+ * X509KeyUsageExtension.cs: Fixed new enum name for CrlSign.
+ * X509KeyUsageFlags.cs: Fixed values and removed [Serializable].
+ * X509NameType.cs: Fixed values and removed [Serializable].
+ * X509Store.cs: Added new constructor that accept an IntPtr and the
+ StoreHandle property. Fixed compiler warnings.
+
2005-04-23 Sebastien Pouliot <[EMAIL PROTECTED]>
* X509CertificateEx.cs, X509CertificateExCollection.cs,
Modified:
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509CertificateEx.cs
===================================================================
---
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509CertificateEx.cs
2005-04-24 09:57:50 UTC (rev 43511)
+++
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509CertificateEx.cs
2005-04-24 14:57:52 UTC (rev 43512)
@@ -63,12 +63,23 @@
_cert = new MX.X509Certificate (this.RawData);
}
+ public X509Certificate2 (byte[] rawData, SecureString password)
: base (rawData, password)
+ {
+ _cert = new MX.X509Certificate (this.RawData);
+ }
+
public X509Certificate2 (byte[] rawData, string password,
X509KeyStorageFlags keyStorageFlags)
: base (rawData, password, keyStorageFlags)
{
_cert = new MX.X509Certificate (this.RawData);
}
+ public X509Certificate2 (byte[] rawData, SecureString password,
X509KeyStorageFlags keyStorageFlags)
+ : base (rawData, password, keyStorageFlags)
+ {
+ _cert = new MX.X509Certificate (this.RawData);
+ }
+
public X509Certificate2 (string fileName) : base (fileName)
{
_cert = new MX.X509Certificate (this.RawData);
@@ -79,18 +90,29 @@
_cert = new MX.X509Certificate (this.RawData);
}
+ public X509Certificate2 (string fileName, SecureString
password)
+ {
+ _cert = new MX.X509Certificate (this.RawData);
+ }
+
public X509Certificate2 (string fileName, string password,
X509KeyStorageFlags keyStorageFlags)
: base (fileName, password, keyStorageFlags)
{
_cert = new MX.X509Certificate (this.RawData);
}
+ public X509Certificate2 (string fileName, SecureString
password, X509KeyStorageFlags keyStorageFlags)
+ : base (fileName, password, keyStorageFlags)
+ {
+ _cert = new MX.X509Certificate (this.RawData);
+ }
+
public X509Certificate2 (IntPtr handle) : base (handle)
{
_cert = new MX.X509Certificate (this.RawData);
}
- public X509Certificate2 (X509Certificate2 certificate)
+ public X509Certificate2 (X509Certificate certificate)
{
_cert = new MX.X509Certificate (this.RawData);
}
@@ -112,6 +134,11 @@
}
[MonoTODO]
+ public bool HasPrivateKey {
+ get { return false; }
+ }
+
+ [MonoTODO]
public X500DistinguishedName IssuerName {
get { return null; }
}
@@ -203,6 +230,11 @@
base.Import (rawData, password, keyStorageFlags);
}
+ public override void Import (byte[] rawData, SecureString
password, X509KeyStorageFlags keyStorageFlags)
+ {
+ base.Import (rawData, password, keyStorageFlags);
+ }
+
public override void Import (string fileName)
{
base.Import (fileName);
@@ -213,6 +245,11 @@
base.Import (fileName, password, keyStorageFlags);
}
+ public override void Import (string fileName, SecureString
password, X509KeyStorageFlags keyStorageFlags)
+ {
+ base.Import (fileName, password, keyStorageFlags);
+ }
+
public override void Reset ()
{
_serial = null;
@@ -232,6 +269,16 @@
return null;
}
+ [MonoTODO]
+ public bool Verify ()
+ {
+ X509Chain chain = new X509Chain ();
+ if (!chain.Build (this))
+ return false;
+ // TODO - check chain and other stuff ???
+ return true;
+ }
+
// static methods
[MonoTODO]
Modified:
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509CertificateExCollection.cs
===================================================================
---
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509CertificateExCollection.cs
2005-04-24 09:57:50 UTC (rev 43511)
+++
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509CertificateExCollection.cs
2005-04-24 14:57:52 UTC (rev 43512)
@@ -48,6 +48,11 @@
AddRange (certificates);
}
+ public X509Certificate2Collection (X509Certificate2
certificate)
+ {
+ Add (certificate);
+ }
+
public X509Certificate2Collection (X509Certificate2[]
certificates)
{
AddRange (certificates);
Modified:
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509EnhancedKeyUsageExtension.cs
===================================================================
---
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509EnhancedKeyUsageExtension.cs
2005-04-24 09:57:50 UTC (rev 43511)
+++
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509EnhancedKeyUsageExtension.cs
2005-04-24 14:57:52 UTC (rev 43512)
@@ -160,8 +160,6 @@
if (_enhKeyUsage.Count == 0)
return "Information Not Available";
- bool first = false;
- bool onebyte = true;
StringBuilder sb = new StringBuilder ();
for (int i=0; i < _enhKeyUsage.Count; i++) {
Modified:
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509KeyUsageExtension.cs
===================================================================
---
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509KeyUsageExtension.cs
2005-04-24 09:57:50 UTC (rev 43511)
+++
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509KeyUsageExtension.cs
2005-04-24 14:57:52 UTC (rev 43512)
@@ -41,7 +41,7 @@
internal const string oid = "2.5.29.15";
internal const string friendlyName = "Key Usage";
- internal const X509KeyUsageFlags all =
X509KeyUsageFlags.EncipherOnly | X509KeyUsageFlags.CRLSign |
+ internal const X509KeyUsageFlags all =
X509KeyUsageFlags.EncipherOnly | X509KeyUsageFlags.CrlSign |
X509KeyUsageFlags.KeyCertSign |
X509KeyUsageFlags.KeyAgreement | X509KeyUsageFlags.DataEncipherment |
X509KeyUsageFlags.KeyEncipherment |
X509KeyUsageFlags.NonRepudiation |
X509KeyUsageFlags.DigitalSignature |
X509KeyUsageFlags.DecipherOnly;
@@ -219,7 +219,7 @@
sb.Append (", ");
sb.Append ("Certificate Signing");
}
- if ((_keyUsages & X509KeyUsageFlags.CRLSign) != 0) {
+ if ((_keyUsages & X509KeyUsageFlags.CrlSign) != 0) {
if (sb.Length > 0)
sb.Append (", ");
sb.Append ("Off-line CRL Signing, CRL Signing");
Modified:
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509KeyUsageFlags.cs
===================================================================
---
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509KeyUsageFlags.cs
2005-04-24 09:57:50 UTC (rev 43511)
+++
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509KeyUsageFlags.cs
2005-04-24 14:57:52 UTC (rev 43512)
@@ -5,7 +5,7 @@
// Sebastien Pouliot <[EMAIL PROTECTED]>
//
// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004 Novell Inc. (http://www.novell.com)
+// Copyright (C) 2004-2005 Novell Inc. (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
@@ -29,15 +29,13 @@
#if NET_2_0
-using System;
-
namespace System.Security.Cryptography.X509Certificates {
[Flags]
- [Serializable]
public enum X509KeyUsageFlags {
+ None = 0,
EncipherOnly = 1,
- CRLSign = 2,
+ CrlSign = 2,
KeyCertSign = 4,
KeyAgreement = 8,
DataEncipherment = 16,
Modified:
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509NameType.cs
===================================================================
---
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509NameType.cs
2005-04-24 09:57:50 UTC (rev 43511)
+++
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509NameType.cs
2005-04-24 14:57:52 UTC (rev 43512)
@@ -5,7 +5,7 @@
// Sebastien Pouliot <[EMAIL PROTECTED]>
//
// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004 Novell Inc. (http://www.novell.com)
+// Copyright (C) 2004-2005 Novell Inc. (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
@@ -29,17 +29,14 @@
#if NET_2_0
-using System;
-
namespace System.Security.Cryptography.X509Certificates {
- [Serializable]
public enum X509NameType {
- SimpleName = 1,
- EmailName = 2,
- UpnName = 3,
- DnsName = 4,
- UrlName = 5
+ SimpleName,
+ EmailName,
+ UpnName,
+ DnsName,
+ UrlName
}
}
Modified:
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509Store.cs
===================================================================
---
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509Store.cs
2005-04-24 09:57:50 UTC (rev 43511)
+++
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509Store.cs
2005-04-24 14:57:52 UTC (rev 43512)
@@ -68,6 +68,12 @@
{
}
+ public X509Store (IntPtr storeHandle)
+ {
+ // CryptoAPI compatibility (unmanaged handle)
+ throw new NotSupportedException ();
+ }
+
[MonoTODO ("call Mono.Security.X509.X509Store*")]
public X509Store (string storeName, StoreLocation storeLocation)
{
@@ -100,6 +106,10 @@
get { return ((_flags & OpenFlags.ReadOnly) !=
OpenFlags.ReadOnly); }
}
+ public IntPtr StoreHandle {
+ get { return IntPtr.Zero; }
+ }
+
// methods
private static string StoreNameToString (StoreName sn)
@@ -120,7 +130,7 @@
if (!ReadOnly) {
try {
- Mono.Security.X509.X509Certificate x =
new Mono.Security.X509.X509Certificate (certificate.RawData);
+ // Mono.Security.X509.X509Certificate x
= new Mono.Security.X509.X509Certificate (certificate.RawData);
// TODO
}
catch {
@@ -150,9 +160,9 @@
public void Open (OpenFlags flags)
{
_flags = flags;
- bool readOnly = ((flags & OpenFlags.ReadOnly) ==
OpenFlags.ReadOnly);
+ /*bool readOnly = ((flags & OpenFlags.ReadOnly) ==
OpenFlags.ReadOnly);
bool create = !((flags & OpenFlags.OpenExistingOnly) ==
OpenFlags.OpenExistingOnly);
- bool archive = ((flags & OpenFlags.IncludeArchived) ==
OpenFlags.IncludeArchived);
+ bool archive = ((flags & OpenFlags.IncludeArchived) ==
OpenFlags.IncludeArchived);*/
// TODO
}
@@ -164,7 +174,7 @@
if (!ReadOnly) {
try {
- Mono.Security.X509.X509Certificate x =
new Mono.Security.X509.X509Certificate (certificate.RawData);
+ //Mono.Security.X509.X509Certificate x
= new Mono.Security.X509.X509Certificate (certificate.RawData);
// TODO
}
catch {
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches