Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Pouliot <sebastien@ximian.com>2005-04-27 18:20:42 +0400
committerSebastien Pouliot <sebastien@ximian.com>2005-04-27 18:20:42 +0400
commitd51e9eae9e9a9b5a7353aef07401eb11ace81ebf (patch)
tree8aa75fa00d061730371155f4f31ef33d3d2d500c /mcs/class/System.Security/System.Security.Cryptography.X509Certificates
parent30598dc4b527e662724fa889bb5a408fca610750 (diff)
2005-04-27 Sebastien Pouliot <sebastien@ximian.com>
* 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. svn path=/trunk/mcs/; revision=43654
Diffstat (limited to 'mcs/class/System.Security/System.Security.Cryptography.X509Certificates')
-rwxr-xr-xmcs/class/System.Security/System.Security.Cryptography.X509Certificates/ChangeLog17
-rwxr-xr-xmcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509BasicConstraintsExtension.cs3
-rwxr-xr-xmcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509CertificateEx.cs33
-rw-r--r--mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509EnhancedKeyUsageExtension.cs5
-rwxr-xr-xmcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509Extension.cs4
-rwxr-xr-xmcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509KeyUsageExtension.cs3
-rwxr-xr-xmcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509Store.cs1
-rwxr-xr-xmcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509SubjectKeyIdentifierExtension.cs11
8 files changed, 51 insertions, 26 deletions
diff --git a/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/ChangeLog b/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/ChangeLog
index 12b39c5d113..049632401f5 100755
--- a/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/ChangeLog
+++ b/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/ChangeLog
@@ -1,3 +1,20 @@
+2005-04-27 Sebastien Pouliot <sebastien@ximian.com>
+
+ * 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 <sebastien@ximian.com>
* X509CertificateEx.cs: Used new features from Mono.Security.dll to
diff --git a/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509BasicConstraintsExtension.cs b/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509BasicConstraintsExtension.cs
index 92971b85247..b342bb04d07 100755
--- a/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509BasicConstraintsExtension.cs
+++ b/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509BasicConstraintsExtension.cs
@@ -120,8 +120,7 @@ namespace System.Security.Cryptography.X509Certificates {
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)
diff --git a/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509CertificateEx.cs b/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509CertificateEx.cs
index 5563ccf24cd..59753e8defe 100755
--- a/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509CertificateEx.cs
+++ b/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509CertificateEx.cs
@@ -51,71 +51,71 @@ namespace System.Security.Cryptography.X509Certificates {
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 @@ namespace System.Security.Cryptography.X509Certificates {
}
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 {
diff --git a/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509EnhancedKeyUsageExtension.cs b/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509EnhancedKeyUsageExtension.cs
index b0f588b566b..c867d3548e5 100644
--- a/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509EnhancedKeyUsageExtension.cs
+++ b/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509EnhancedKeyUsageExtension.cs
@@ -76,6 +76,8 @@ namespace System.Security.Cryptography.X509Certificates {
switch (_status) {
case AsnDecodeStatus.Ok:
case AsnDecodeStatus.InformationNotAvailable:
+ if (_enhKeyUsage == null)
+ _enhKeyUsage = new OidCollection ();
_enhKeyUsage.ReadOnly = true;
return _enhKeyUsage;
default:
@@ -89,8 +91,7 @@ namespace System.Security.Cryptography.X509Certificates {
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)
diff --git a/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509Extension.cs b/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509Extension.cs
index 9013c8864d1..311690968fa 100755
--- a/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509Extension.cs
+++ b/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509Extension.cs
@@ -83,7 +83,9 @@ namespace System.Security.Cryptography.X509Certificates {
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."));
diff --git a/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509KeyUsageExtension.cs b/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509KeyUsageExtension.cs
index 5b1d7c5c3b6..dc13d962df7 100755
--- a/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509KeyUsageExtension.cs
+++ b/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509KeyUsageExtension.cs
@@ -92,8 +92,7 @@ namespace System.Security.Cryptography.X509Certificates {
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)
diff --git a/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509Store.cs b/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509Store.cs
index c2ff91f7487..4021dd3876f 100755
--- a/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509Store.cs
+++ b/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509Store.cs
@@ -130,6 +130,7 @@ namespace System.Security.Cryptography.X509Certificates {
if (!ReadOnly) {
try {
+ new Mono.Security.X509.X509Certificate (certificate.RawData);
// Mono.Security.X509.X509Certificate x = new Mono.Security.X509.X509Certificate (certificate.RawData);
// TODO
}
diff --git a/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509SubjectKeyIdentifierExtension.cs b/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509SubjectKeyIdentifierExtension.cs
index f20692e8c55..fa212b03c23 100755
--- a/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509SubjectKeyIdentifierExtension.cs
+++ b/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509SubjectKeyIdentifierExtension.cs
@@ -43,6 +43,7 @@ namespace System.Security.Cryptography.X509Certificates {
internal const string friendlyName = "Subject Key Identifier";
private byte[] _subjectKeyIdentifier;
+ private string _ski;
private AsnDecodeStatus _status;
// constructors
@@ -107,9 +108,9 @@ namespace System.Security.Cryptography.X509Certificates {
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 @@ namespace System.Security.Cryptography.X509Certificates {
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 @@ namespace System.Security.Cryptography.X509Certificates {
{
if ((extension == null) || (extension.Length == 0))
return AsnDecodeStatus.BadAsn;
+ _ski = String.Empty;
if (extension [0] != 0x04)
return AsnDecodeStatus.BadTag;
if (extension.Length == 2)