Author: spouliot
Date: 2005-04-27 10:20:42 -0400 (Wed, 27 Apr 2005)
New Revision: 43654
Modified:
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/ChangeLog
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509BasicConstraintsExtension.cs
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509CertificateEx.cs
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509EnhancedKeyUsageExtension.cs
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509Extension.cs
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509KeyUsageExtension.cs
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509Store.cs
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509SubjectKeyIdentifierExtension.cs
Log:
2005-04-27 Sebastien Pouliot <[EMAIL PROTECTED]>
* X509BasicConstraintsExtension.cs: Now throw ArgumentNullException in
CopyFrom (fixed in beta2).
* X509CertificateEx.cs: Throw a CryptographicException in the RawData
property if no certificate is loaded in the instance.
* X509EnhancedKeyUsageExtension.cs: Now throw ArgumentNullException in
CopyFrom (fixed in beta2).
* X509Extension.cs: Now throw ArgumentNullException in CopyFrom (fixed
in beta2).
* X509KeyUsageExtension.cs: Now throw ArgumentNullException in
CopyFrom (fixed in beta2).
* X509Store.cs: Re-added certificate creation to get the exception.
* X509SubjectKeyIdentifierExtension.cs: Throw ArgumentNullException in
CopyFrom (fixed in beta2). Fix SubjectKeyIdentifier to return an empty
string (not null) after (unsucessful) decoding.
Modified:
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/ChangeLog
===================================================================
---
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/ChangeLog
2005-04-27 14:15:06 UTC (rev 43653)
+++
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/ChangeLog
2005-04-27 14:20:42 UTC (rev 43654)
@@ -1,3 +1,20 @@
+2005-04-27 Sebastien Pouliot <[EMAIL PROTECTED]>
+
+ * X509BasicConstraintsExtension.cs: Now throw ArgumentNullException in
+ CopyFrom (fixed in beta2).
+ * X509CertificateEx.cs: Throw a CryptographicException in the RawData
+ property if no certificate is loaded in the instance.
+ * X509EnhancedKeyUsageExtension.cs: Now throw ArgumentNullException in
+ CopyFrom (fixed in beta2).
+ * X509Extension.cs: Now throw ArgumentNullException in CopyFrom (fixed
+ in beta2).
+ * X509KeyUsageExtension.cs: Now throw ArgumentNullException in
+ CopyFrom (fixed in beta2).
+ * X509Store.cs: Re-added certificate creation to get the exception.
+ * X509SubjectKeyIdentifierExtension.cs: Throw ArgumentNullException in
+ CopyFrom (fixed in beta2). Fix SubjectKeyIdentifier to return an empty
+ string (not null) after (unsucessful) decoding.
+
2005-04-26 Sebastien Pouliot <[EMAIL PROTECTED]>
* X509CertificateEx.cs: Used new features from Mono.Security.dll to
Modified:
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509BasicConstraintsExtension.cs
===================================================================
---
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509BasicConstraintsExtension.cs
2005-04-27 14:15:06 UTC (rev 43653)
+++
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509BasicConstraintsExtension.cs
2005-04-27 14:20:42 UTC (rev 43654)
@@ -120,8 +120,7 @@
public override void CopyFrom (AsnEncodedData asnEncodedData)
{
if (asnEncodedData == null)
- throw new ArgumentException ("asnEncodedData");
-// MS BUG throw new ArgumentNullException
("asnEncodedData");
+ throw new ArgumentNullException
("asnEncodedData");
X509Extension ex = (asnEncodedData as X509Extension);
if (ex == null)
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-27 14:15:06 UTC (rev 43653)
+++
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509CertificateEx.cs
2005-04-27 14:20:42 UTC (rev 43654)
@@ -51,71 +51,71 @@
public X509Certificate2 () : base ()
{
- _cert = new MX.X509Certificate (this.RawData);
+ _cert = null;
}
public X509Certificate2 (byte[] rawData) : base (rawData)
{
- _cert = new MX.X509Certificate (this.RawData);
+ _cert = new MX.X509Certificate (base.GetRawCertData ());
}
public X509Certificate2 (byte[] rawData, string password) :
base (rawData, password)
{
- _cert = new MX.X509Certificate (this.RawData);
+ _cert = new MX.X509Certificate (base.GetRawCertData ());
}
public X509Certificate2 (byte[] rawData, SecureString password)
: base (rawData, password)
{
- _cert = new MX.X509Certificate (this.RawData);
+ _cert = new MX.X509Certificate (base.GetRawCertData ());
}
public X509Certificate2 (byte[] rawData, string password,
X509KeyStorageFlags keyStorageFlags)
: base (rawData, password, keyStorageFlags)
{
- _cert = new MX.X509Certificate (this.RawData);
+ _cert = new MX.X509Certificate (base.GetRawCertData ());
}
public X509Certificate2 (byte[] rawData, SecureString password,
X509KeyStorageFlags keyStorageFlags)
: base (rawData, password, keyStorageFlags)
{
- _cert = new MX.X509Certificate (this.RawData);
+ _cert = new MX.X509Certificate (base.GetRawCertData ());
}
public X509Certificate2 (string fileName) : base (fileName)
{
- _cert = new MX.X509Certificate (this.RawData);
+ _cert = new MX.X509Certificate (base.GetRawCertData ());
}
public X509Certificate2 (string fileName, string password)
{
- _cert = new MX.X509Certificate (this.RawData);
+ _cert = new MX.X509Certificate (base.GetRawCertData ());
}
public X509Certificate2 (string fileName, SecureString
password)
{
- _cert = new MX.X509Certificate (this.RawData);
+ _cert = new MX.X509Certificate (base.GetRawCertData ());
}
public X509Certificate2 (string fileName, string password,
X509KeyStorageFlags keyStorageFlags)
: base (fileName, password, keyStorageFlags)
{
- _cert = new MX.X509Certificate (this.RawData);
+ _cert = new MX.X509Certificate (base.GetRawCertData ());
}
public X509Certificate2 (string fileName, SecureString
password, X509KeyStorageFlags keyStorageFlags)
: base (fileName, password, keyStorageFlags)
{
- _cert = new MX.X509Certificate (this.RawData);
+ _cert = new MX.X509Certificate (base.GetRawCertData ());
}
public X509Certificate2 (IntPtr handle) : base (handle)
{
- _cert = new MX.X509Certificate (this.RawData);
+ _cert = new MX.X509Certificate (base.GetRawCertData ());
}
public X509Certificate2 (X509Certificate certificate)
{
- _cert = new MX.X509Certificate (this.RawData);
+ _cert = new MX.X509Certificate (base.GetRawCertData ());
}
// properties
@@ -180,7 +180,12 @@
}
public byte[] RawData {
- get { return base.GetRawCertData (); }
+ get {
+ if (_cert == null) {
+ throw new CryptographicException
(Locale.GetText ("No certificate data."));
+ }
+ return base.GetRawCertData ();
+ }
}
public string SerialNumber {
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-27 14:15:06 UTC (rev 43653)
+++
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509EnhancedKeyUsageExtension.cs
2005-04-27 14:20:42 UTC (rev 43654)
@@ -76,6 +76,8 @@
switch (_status) {
case AsnDecodeStatus.Ok:
case AsnDecodeStatus.InformationNotAvailable:
+ if (_enhKeyUsage == null)
+ _enhKeyUsage = new
OidCollection ();
_enhKeyUsage.ReadOnly = true;
return _enhKeyUsage;
default:
@@ -89,8 +91,7 @@
public override void CopyFrom (AsnEncodedData asnEncodedData)
{
if (asnEncodedData == null)
- throw new ArgumentException ("encodedData");
-// MS BUG throw new ArgumentNullException ("encodedData");
+ throw new ArgumentNullException ("encodedData");
X509Extension ex = (asnEncodedData as X509Extension);
if (ex == null)
Modified:
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509Extension.cs
===================================================================
---
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509Extension.cs
2005-04-27 14:15:06 UTC (rev 43653)
+++
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509Extension.cs
2005-04-27 14:20:42 UTC (rev 43654)
@@ -83,7 +83,9 @@
public override void CopyFrom (AsnEncodedData asnEncodedData)
{
- // note: null isn't directly checked here - so it
throws the ArgumentException
+ if (asnEncodedData == null)
+ throw new ArgumentNullException ("encodedData");
+
X509Extension ex = (asnEncodedData as X509Extension);
if (ex == null)
throw new ArgumentException (Locale.GetText
("Expected a X509Extension instance."));
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-27 14:15:06 UTC (rev 43653)
+++
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509KeyUsageExtension.cs
2005-04-27 14:20:42 UTC (rev 43654)
@@ -92,8 +92,7 @@
public override void CopyFrom (AsnEncodedData encodedData)
{
if (encodedData == null)
- throw new ArgumentException ("encodedData");
-// MS BUG throw new ArgumentNullException ("encodedData");
+ throw new ArgumentNullException ("encodedData");
X509Extension ex = (encodedData as X509Extension);
if (ex == null)
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-27 14:15:06 UTC (rev 43653)
+++
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509Store.cs
2005-04-27 14:20:42 UTC (rev 43654)
@@ -130,6 +130,7 @@
if (!ReadOnly) {
try {
+ new Mono.Security.X509.X509Certificate
(certificate.RawData);
// Mono.Security.X509.X509Certificate x
= new Mono.Security.X509.X509Certificate (certificate.RawData);
// TODO
}
Modified:
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509SubjectKeyIdentifierExtension.cs
===================================================================
---
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509SubjectKeyIdentifierExtension.cs
2005-04-27 14:15:06 UTC (rev 43653)
+++
trunk/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509SubjectKeyIdentifierExtension.cs
2005-04-27 14:20:42 UTC (rev 43654)
@@ -43,6 +43,7 @@
internal const string friendlyName = "Subject Key Identifier";
private byte[] _subjectKeyIdentifier;
+ private string _ski;
private AsnDecodeStatus _status;
// constructors
@@ -107,9 +108,9 @@
switch (_status) {
case AsnDecodeStatus.Ok:
case AsnDecodeStatus.InformationNotAvailable:
- if (_subjectKeyIdentifier == null)
- return String.Empty;
- return CryptoConvert.ToHex
(_subjectKeyIdentifier);
+ if (_subjectKeyIdentifier != null)
+ _ski = CryptoConvert.ToHex
(_subjectKeyIdentifier);
+ return _ski;
default:
throw new CryptographicException
("Badly encoded extension.");
}
@@ -121,8 +122,7 @@
public override void CopyFrom (AsnEncodedData encodedData)
{
if (encodedData == null)
- throw new ArgumentException ("encodedData");
-// MS BUG throw new ArgumentNullException ("encodedData");
+ throw new ArgumentNullException ("encodedData");
X509Extension ex = (encodedData as X509Extension);
if (ex == null)
@@ -183,6 +183,7 @@
{
if ((extension == null) || (extension.Length == 0))
return AsnDecodeStatus.BadAsn;
+ _ski = String.Empty;
if (extension [0] != 0x04)
return AsnDecodeStatus.BadTag;
if (extension.Length == 2)
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches