[pgsqlclient-checkins] pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.X509.Extensions Auth
Status: Inactive
Brought to you by:
carlosga_fb
From: Carlos Guzm?n ?l. <car...@us...> - 2004-05-09 12:06:55
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.X509.Extensions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30263 Modified Files: AuthorityKeyIdentifierExtension.cs BasicConstraintsExtension.cs CertificatePoliciesExtension.cs CRLDistributionPointsExtension.cs ExtendedKeyUsageExtension.cs KeyAttributesExtension.cs KeyUsageExtension.cs NetscapeCertTypeExtension.cs PrivateKeyUsagePeriodExtension.cs SubjectAltNameExtension.cs SubjectKeyIdentifierExtension.cs Log Message: Sync Mono.Security stuff wit Mono Beta 1 sources Index: KeyAttributesExtension.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.X509.Extensions/KeyAttributesExtension.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** KeyAttributesExtension.cs 5 Mar 2004 23:19:07 -0000 1.1 --- KeyAttributesExtension.cs 9 May 2004 12:06:37 -0000 1.2 *************** *** 3,12 **** // // Author: ! // Sebastien Pouliot (spo...@mo...) // // (C) 2003 Motus Technologies Inc. (http://www.motus.com) // using System; using System.Text; --- 3,14 ---- // // Author: ! // Sebastien Pouliot <seb...@xi...> // // (C) 2003 Motus Technologies Inc. (http://www.motus.com) + // (C) 2004 Novell (http://www.novell.com) // using System; + using System.Globalization; using System.Text; *************** *** 41,45 **** // ( CONSTRAINED BY { -- at least one component shall be present -- }) ! internal class KeyAttributesExtension : X509Extension { private byte[] keyId; --- 43,47 ---- // ( CONSTRAINED BY { -- at least one component shall be present -- }) ! public class KeyAttributesExtension : X509Extension { private byte[] keyId; *************** *** 53,59 **** } ! public KeyAttributesExtension (ASN1 asn1) : base (asn1) {} ! public KeyAttributesExtension (X509Extension extension) : base (extension) {} protected override void Decode () --- 55,65 ---- } ! public KeyAttributesExtension (ASN1 asn1) : base (asn1) ! { ! } ! public KeyAttributesExtension (X509Extension extension) : base (extension) ! { ! } protected override void Decode () *************** *** 103,107 **** public byte[] KeyIdentifier { ! get { return keyId; } } --- 109,117 ---- public byte[] KeyIdentifier { ! get { ! if (keyId == null) ! return null; ! return (byte[]) keyId.Clone (); ! } } *************** *** 118,124 **** } ! public bool Support (KeyUsage usage) { ! int x = Convert.ToInt32 (usage); return ((x & kubits) == x); } --- 128,134 ---- } ! public bool Support (KeyUsages usage) { ! int x = Convert.ToInt32 (usage, CultureInfo.InvariantCulture); return ((x & kubits) == x); } *************** *** 131,135 **** int x = 0; while (x < keyId.Length) { ! sb.Append (keyId [x].ToString ("X2")); if (x % 2 == 1) sb.Append (" "); --- 141,145 ---- int x = 0; while (x < keyId.Length) { ! sb.Append (keyId [x].ToString ("X2", CultureInfo.InvariantCulture)); if (x % 2 == 1) sb.Append (" "); *************** *** 142,183 **** sb.Append ("Key Usage="); const string separator = " , "; ! if (Support (KeyUsage.digitalSignature)) sb.Append ("Digital Signature"); ! if (Support (KeyUsage.nonRepudiation)) { if (sb.Length > 0) sb.Append (separator); sb.Append ("Non-Repudiation"); } ! if (Support (KeyUsage.keyEncipherment)) { if (sb.Length > 0) sb.Append (separator); sb.Append ("Key Encipherment"); } ! if (Support (KeyUsage.dataEncipherment)) { if (sb.Length > 0) sb.Append (separator); sb.Append ("Data Encipherment"); } ! if (Support (KeyUsage.keyAgreement)) { if (sb.Length > 0) sb.Append (separator); sb.Append ("Key Agreement"); } ! if (Support (KeyUsage.keyCertSign)) { if (sb.Length > 0) sb.Append (separator); sb.Append ("Certificate Signing"); } ! if (Support (KeyUsage.cRLSign)) { if (sb.Length > 0) sb.Append (separator); sb.Append ("CRL Signing"); } ! if (Support (KeyUsage.encipherOnly)) { if (sb.Length > 0) sb.Append (separator); sb.Append ("Encipher Only "); // ??? } ! if (Support (KeyUsage.decipherOnly)) { if (sb.Length > 0) sb.Append (separator); --- 152,193 ---- sb.Append ("Key Usage="); const string separator = " , "; ! if (Support (KeyUsages.digitalSignature)) sb.Append ("Digital Signature"); ! if (Support (KeyUsages.nonRepudiation)) { if (sb.Length > 0) sb.Append (separator); sb.Append ("Non-Repudiation"); } ! if (Support (KeyUsages.keyEncipherment)) { if (sb.Length > 0) sb.Append (separator); sb.Append ("Key Encipherment"); } ! if (Support (KeyUsages.dataEncipherment)) { if (sb.Length > 0) sb.Append (separator); sb.Append ("Data Encipherment"); } ! if (Support (KeyUsages.keyAgreement)) { if (sb.Length > 0) sb.Append (separator); sb.Append ("Key Agreement"); } ! if (Support (KeyUsages.keyCertSign)) { if (sb.Length > 0) sb.Append (separator); sb.Append ("Certificate Signing"); } ! if (Support (KeyUsages.cRLSign)) { if (sb.Length > 0) sb.Append (separator); sb.Append ("CRL Signing"); } ! if (Support (KeyUsages.encipherOnly)) { if (sb.Length > 0) sb.Append (separator); sb.Append ("Encipher Only "); // ??? } ! if (Support (KeyUsages.decipherOnly)) { if (sb.Length > 0) sb.Append (separator); *************** *** 185,189 **** } sb.Append ("("); ! sb.Append (kubits.ToString ("X2")); sb.Append (")"); sb.Append (Environment.NewLine); --- 195,199 ---- } sb.Append ("("); ! sb.Append (kubits.ToString ("X2", CultureInfo.InvariantCulture)); sb.Append (")"); sb.Append (Environment.NewLine); *************** *** 192,201 **** if (notBefore != DateTime.MinValue) { sb.Append ("Not Before="); ! sb.Append (notBefore.ToString ()); sb.Append (Environment.NewLine); } if (notAfter != DateTime.MinValue) { sb.Append ("Not After="); ! sb.Append (notAfter.ToString ()); sb.Append (Environment.NewLine); } --- 202,211 ---- if (notBefore != DateTime.MinValue) { sb.Append ("Not Before="); ! sb.Append (notBefore.ToString (CultureInfo.CurrentUICulture)); sb.Append (Environment.NewLine); } if (notAfter != DateTime.MinValue) { sb.Append ("Not After="); ! sb.Append (notAfter.ToString (CultureInfo.CurrentUICulture)); sb.Append (Environment.NewLine); } Index: NetscapeCertTypeExtension.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.X509.Extensions/NetscapeCertTypeExtension.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NetscapeCertTypeExtension.cs 5 Mar 2004 23:19:07 -0000 1.1 --- NetscapeCertTypeExtension.cs 9 May 2004 12:06:37 -0000 1.2 *************** *** 9,12 **** --- 9,13 ---- using System; + using System.Globalization; using System.Text; *************** *** 24,28 **** // http://www.alvestrand.no/objectid/2.16.840.1.113730.1.1.html ! internal class NetscapeCertTypeExtension : X509Extension { /* --- 25,29 ---- // http://www.alvestrand.no/objectid/2.16.840.1.113730.1.1.html ! public class NetscapeCertTypeExtension : X509Extension { /* *************** *** 39,49 **** // note: because nothing is simple in ASN.1 bits are reversed [Flags] ! public enum CertType { SslClient = 0x80, SslServer = 0x40, Smime = 0x20, ObjectSigning = 0x10, ! SslCa = 0x04, ! SmimeCa = 0x02, ObjectSigningCA = 0x01 } --- 40,50 ---- // note: because nothing is simple in ASN.1 bits are reversed [Flags] ! public enum CertTypes { SslClient = 0x80, SslServer = 0x40, Smime = 0x20, ObjectSigning = 0x10, ! SslCA = 0x04, ! SmimeCA = 0x02, ObjectSigningCA = 0x01 } *************** *** 56,62 **** } ! public NetscapeCertTypeExtension (ASN1 asn1) : base (asn1) {} ! public NetscapeCertTypeExtension (X509Extension extension) : base (extension) {} protected override void Decode () --- 57,67 ---- } ! public NetscapeCertTypeExtension (ASN1 asn1) : base (asn1) ! { ! } ! public NetscapeCertTypeExtension (X509Extension extension) : base (extension) ! { ! } protected override void Decode () *************** *** 79,85 **** }*/ ! public bool Support (CertType usage) { ! int x = Convert.ToInt32 (usage); return ((x & ctbits) == x); } --- 84,90 ---- }*/ ! public bool Support (CertTypes usage) { ! int x = Convert.ToInt32 (usage, CultureInfo.InvariantCulture); return ((x & ctbits) == x); } *************** *** 89,120 **** const string separator = " , "; StringBuilder sb = new StringBuilder (); ! if (Support (CertType.SslClient)) sb.Append ("SSL Client Authentication"); ! if (Support (CertType.SslServer)) { if (sb.Length > 0) sb.Append (separator); sb.Append ("SSL Server Authentication"); } ! if (Support (CertType.Smime)) { if (sb.Length > 0) sb.Append (separator); sb.Append ("SMIME"); } ! if (Support (CertType.ObjectSigning)) { if (sb.Length > 0) sb.Append (separator); sb.Append ("Object Signing"); } ! if (Support (CertType.SslCa)) { if (sb.Length > 0) sb.Append (separator); sb.Append ("SSL CA"); } ! if (Support (CertType.SmimeCa)) { if (sb.Length > 0) sb.Append (separator); sb.Append ("SMIME CA"); } ! if (Support (CertType.ObjectSigningCA)) { if (sb.Length > 0) sb.Append (separator); --- 94,125 ---- const string separator = " , "; StringBuilder sb = new StringBuilder (); ! if (Support (CertTypes.SslClient)) sb.Append ("SSL Client Authentication"); ! if (Support (CertTypes.SslServer)) { if (sb.Length > 0) sb.Append (separator); sb.Append ("SSL Server Authentication"); } ! if (Support (CertTypes.Smime)) { if (sb.Length > 0) sb.Append (separator); sb.Append ("SMIME"); } ! if (Support (CertTypes.ObjectSigning)) { if (sb.Length > 0) sb.Append (separator); sb.Append ("Object Signing"); } ! if (Support (CertTypes.SslCA)) { if (sb.Length > 0) sb.Append (separator); sb.Append ("SSL CA"); } ! if (Support (CertTypes.SmimeCA)) { if (sb.Length > 0) sb.Append (separator); sb.Append ("SMIME CA"); } ! if (Support (CertTypes.ObjectSigningCA)) { if (sb.Length > 0) sb.Append (separator); *************** *** 122,126 **** } sb.Append ("("); ! sb.Append (ctbits.ToString ("X2")); sb.Append (")"); sb.Append (Environment.NewLine); --- 127,131 ---- } sb.Append ("("); ! sb.Append (ctbits.ToString ("X2", CultureInfo.InvariantCulture)); sb.Append (")"); sb.Append (Environment.NewLine); Index: ExtendedKeyUsageExtension.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.X509.Extensions/ExtendedKeyUsageExtension.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ExtendedKeyUsageExtension.cs 5 Mar 2004 23:19:07 -0000 1.1 --- ExtendedKeyUsageExtension.cs 9 May 2004 12:06:37 -0000 1.2 *************** *** 3,9 **** // // Author: ! // Sebastien Pouliot (spo...@mo...) // // (C) 2003 Motus Technologies Inc. (http://www.motus.com) // --- 3,10 ---- // // Author: ! // Sebastien Pouliot <seb...@xi...> // // (C) 2003 Motus Technologies Inc. (http://www.motus.com) + // (C) 2004 Novell (http://www.novell.com) // *************** *** 25,29 **** */ ! internal class ExtendedKeyUsageExtension : X509Extension { private ArrayList keyPurpose; --- 26,30 ---- */ ! public class ExtendedKeyUsageExtension : X509Extension { private ArrayList keyPurpose; *************** *** 35,41 **** } ! public ExtendedKeyUsageExtension (ASN1 asn1) : base (asn1) {} ! public ExtendedKeyUsageExtension (X509Extension extension) : base (extension) {} protected override void Decode () --- 36,46 ---- } ! public ExtendedKeyUsageExtension (ASN1 asn1) : base (asn1) ! { ! } ! public ExtendedKeyUsageExtension (X509Extension extension) : base (extension) ! { ! } protected override void Decode () *************** *** 47,51 **** // for every policy OID for (int i=0; i < sequence.Count; i++) ! keyPurpose.Add (ASN1Convert.ToOID (sequence [i])); } --- 52,56 ---- // for every policy OID for (int i=0; i < sequence.Count; i++) ! keyPurpose.Add (ASN1Convert.ToOid (sequence [i])); } *************** *** 55,59 **** extnValue = new ASN1 (0x30); foreach (string oid in keyPurpose) { ! extnValue.Add (ASN1Convert.FromOID (oid)); } } --- 60,64 ---- extnValue = new ASN1 (0x30); foreach (string oid in keyPurpose) { ! extnValue.Add (ASN1Convert.FromOid (oid)); } } *************** *** 79,93 **** foreach (string s in keyPurpose) { switch (s) { case "1.3.6.1.5.5.7.3.3": sb.Append ("Code Signing"); break; default: sb.Append ("unknown"); break; } ! sb.Append (" ("); ! sb.Append (s); ! sb.Append (")"); ! sb.Append (Environment.NewLine); } return sb.ToString (); --- 84,110 ---- foreach (string s in keyPurpose) { switch (s) { + case "1.3.6.1.5.5.7.3.1": + sb.Append ("Server Authentication"); + break; + case "1.3.6.1.5.5.7.3.2": + sb.Append ("Client Authentication"); + break; case "1.3.6.1.5.5.7.3.3": sb.Append ("Code Signing"); break; + case "1.3.6.1.5.5.7.3.4": + sb.Append ("Email Protection"); + break; + case "1.3.6.1.5.5.7.3.8": + sb.Append ("Time Stamping"); + break; + case "1.3.6.1.5.5.7.3.9": + sb.Append ("OCSP Signing"); + break; default: sb.Append ("unknown"); break; } ! sb.AppendFormat (" ({0}){1}", s, Environment.NewLine); } return sb.ToString (); Index: SubjectAltNameExtension.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.X509.Extensions/SubjectAltNameExtension.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SubjectAltNameExtension.cs 5 Mar 2004 23:19:07 -0000 1.1 --- SubjectAltNameExtension.cs 9 May 2004 12:06:37 -0000 1.2 *************** *** 3,9 **** // // Author: ! // Sebastien Pouliot (spo...@mo...) // // (C) 2003 Motus Technologies Inc. (http://www.motus.com) // --- 3,10 ---- // // Author: ! // Sebastien Pouliot <seb...@xi...> // // (C) 2003 Motus Technologies Inc. (http://www.motus.com) + // (C) 2004 Novell (http://www.novell.com) // *************** *** 49,53 **** // TODO - incomplete (only rfc822Name, dNSName are supported) ! internal class SubjectAltNameExtension : X509Extension { private ArrayList rfc822Name; --- 50,54 ---- // TODO - incomplete (only rfc822Name, dNSName are supported) ! public class SubjectAltNameExtension : X509Extension { private ArrayList rfc822Name; *************** *** 98,105 **** public string[] RFC822 { get { ! string[] names = new string [rfc822Name.Count]; ! for (int i=0; i < rfc822Name.Count; i++) ! names [i] = (string) rfc822Name [i]; ! return names; } } --- 99,105 ---- public string[] RFC822 { get { ! if (rfc822Name == null) ! return new string [0]; ! return (string[]) rfc822Name.ToArray (typeof(string)); } } Index: CertificatePoliciesExtension.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.X509.Extensions/CertificatePoliciesExtension.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CertificatePoliciesExtension.cs 5 Mar 2004 23:19:07 -0000 1.1 --- CertificatePoliciesExtension.cs 9 May 2004 12:06:37 -0000 1.2 *************** *** 69,73 **** // note: partial implementation (only policyIdentifier OID are supported) ! internal class CertificatePoliciesExtension : X509Extension { private Hashtable policies; --- 69,73 ---- // note: partial implementation (only policyIdentifier OID are supported) ! public class CertificatePoliciesExtension : X509Extension { private Hashtable policies; *************** *** 79,85 **** } ! public CertificatePoliciesExtension (ASN1 asn1) : base (asn1) {} ! public CertificatePoliciesExtension (X509Extension extension) : base (extension) {} protected override void Decode () --- 79,89 ---- } ! public CertificatePoliciesExtension (ASN1 asn1) : base (asn1) ! { ! } ! public CertificatePoliciesExtension (X509Extension extension) : base (extension) ! { ! } protected override void Decode () *************** *** 91,95 **** // for every policy OID for (int i=0; i < sequence.Count; i++) { ! policies.Add (ASN1Convert.ToOID (sequence [i][0]), null); } } --- 95,99 ---- // for every policy OID for (int i=0; i < sequence.Count; i++) { ! policies.Add (ASN1Convert.ToOid (sequence [i][0]), null); } } Index: AuthorityKeyIdentifierExtension.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.X509.Extensions/AuthorityKeyIdentifierExtension.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AuthorityKeyIdentifierExtension.cs 5 Mar 2004 23:19:07 -0000 1.1 --- AuthorityKeyIdentifierExtension.cs 9 May 2004 12:06:36 -0000 1.2 *************** *** 9,12 **** --- 9,13 ---- using System; + using System.Globalization; using System.Text; *************** *** 27,32 **** */ ! internal class AuthorityKeyIdentifierExtension : X509Extension ! { private byte[] aki; --- 28,32 ---- */ ! public class AuthorityKeyIdentifierExtension : X509Extension { private byte[] aki; *************** *** 37,43 **** } ! public AuthorityKeyIdentifierExtension (ASN1 asn1) : base (asn1) {} ! public AuthorityKeyIdentifierExtension (X509Extension extension) : base (extension) {} protected override void Decode () --- 37,47 ---- } ! public AuthorityKeyIdentifierExtension (ASN1 asn1) : base (asn1) ! { ! } ! public AuthorityKeyIdentifierExtension (X509Extension extension) : base (extension) ! { ! } protected override void Decode () *************** *** 72,76 **** sb.Append ("KeyID="); while (x < aki.Length) { ! sb.Append (aki [x].ToString ("X2")); if (x % 2 == 1) sb.Append (" "); --- 76,80 ---- sb.Append ("KeyID="); while (x < aki.Length) { ! sb.Append (aki [x].ToString ("X2", CultureInfo.InvariantCulture)); if (x % 2 == 1) sb.Append (" "); Index: CRLDistributionPointsExtension.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.X509.Extensions/CRLDistributionPointsExtension.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CRLDistributionPointsExtension.cs 8 Mar 2004 12:45:57 -0000 1.2 --- CRLDistributionPointsExtension.cs 9 May 2004 12:06:37 -0000 1.3 *************** *** 51,55 **** */ ! internal class CRLDistributionPointsExtension : X509Extension { internal class DP { --- 51,55 ---- */ ! public class CRLDistributionPointsExtension : X509Extension { internal class DP { *************** *** 57,64 **** public ReasonFlags Reasons; public string CRLIssuer; } [Flags] ! internal enum ReasonFlags { Unused = 0, KeyCompromise = 1, --- 57,71 ---- public ReasonFlags Reasons; public string CRLIssuer; + + public DP (string dp, ReasonFlags reasons, string issuer) + { + DistributionPoint = dp; + Reasons = reasons; + CRLIssuer = issuer; + } } [Flags] ! public enum ReasonFlags { Unused = 0, KeyCompromise = 1, Index: PrivateKeyUsagePeriodExtension.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.X509.Extensions/PrivateKeyUsagePeriodExtension.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PrivateKeyUsagePeriodExtension.cs 5 Mar 2004 23:19:07 -0000 1.1 --- PrivateKeyUsagePeriodExtension.cs 9 May 2004 12:06:37 -0000 1.2 *************** *** 9,12 **** --- 9,13 ---- using System; + using System.Globalization; using System.Text; *************** *** 24,28 **** * } */ ! internal class PrivateKeyUsagePeriodExtension : X509Extension { private DateTime notBefore; --- 25,29 ---- * } */ ! public class PrivateKeyUsagePeriodExtension : X509Extension { private DateTime notBefore; *************** *** 34,40 **** } ! public PrivateKeyUsagePeriodExtension (ASN1 asn1) : base (asn1) {} ! public PrivateKeyUsagePeriodExtension (X509Extension extension) : base (extension) {} protected override void Decode () --- 35,45 ---- } ! public PrivateKeyUsagePeriodExtension (ASN1 asn1) : base (asn1) ! { ! } ! public PrivateKeyUsagePeriodExtension (X509Extension extension) : base (extension) ! { ! } protected override void Decode () *************** *** 66,75 **** if (notBefore != DateTime.MinValue) { sb.Append ("Not Before: "); ! sb.Append (notBefore.ToString ()); sb.Append (Environment.NewLine); } if (notAfter != DateTime.MinValue) { sb.Append ("Not After: "); ! sb.Append (notAfter.ToString ()); sb.Append (Environment.NewLine); } --- 71,80 ---- if (notBefore != DateTime.MinValue) { sb.Append ("Not Before: "); ! sb.Append (notBefore.ToString (CultureInfo.CurrentUICulture)); sb.Append (Environment.NewLine); } if (notAfter != DateTime.MinValue) { sb.Append ("Not After: "); ! sb.Append (notAfter.ToString (CultureInfo.CurrentUICulture)); sb.Append (Environment.NewLine); } Index: SubjectKeyIdentifierExtension.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.X509.Extensions/SubjectKeyIdentifierExtension.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SubjectKeyIdentifierExtension.cs 5 Mar 2004 23:19:07 -0000 1.1 --- SubjectKeyIdentifierExtension.cs 9 May 2004 12:06:37 -0000 1.2 *************** *** 9,12 **** --- 9,13 ---- using System; + using System.Globalization; using System.Text; *************** *** 24,28 **** */ ! internal class SubjectKeyIdentifierExtension : X509Extension { private byte[] ski; --- 25,34 ---- */ ! #if INSIDE_CORLIB ! internal ! #else ! public ! #endif ! class SubjectKeyIdentifierExtension : X509Extension { private byte[] ski; *************** *** 33,39 **** } ! public SubjectKeyIdentifierExtension (ASN1 asn1) : base (asn1) {} ! public SubjectKeyIdentifierExtension (X509Extension extension) : base (extension) {} protected override void Decode () --- 39,49 ---- } ! public SubjectKeyIdentifierExtension (ASN1 asn1) : base (asn1) ! { ! } ! public SubjectKeyIdentifierExtension (X509Extension extension) : base (extension) ! { ! } protected override void Decode () *************** *** 50,54 **** public byte[] Identifier { ! get { return (byte[]) ski.Clone (); } } --- 60,68 ---- public byte[] Identifier { ! get { ! if (ski == null) ! return null; ! return (byte[]) ski.Clone (); ! } } *************** *** 61,65 **** int x = 0; while (x < ski.Length) { ! sb.Append (ski [x].ToString ("X2")); if (x % 2 == 1) sb.Append (" "); --- 75,79 ---- int x = 0; while (x < ski.Length) { ! sb.Append (ski [x].ToString ("X2", CultureInfo.InvariantCulture)); if (x % 2 == 1) sb.Append (" "); Index: BasicConstraintsExtension.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.X509.Extensions/BasicConstraintsExtension.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BasicConstraintsExtension.cs 5 Mar 2004 23:19:07 -0000 1.1 --- BasicConstraintsExtension.cs 9 May 2004 12:06:37 -0000 1.2 *************** *** 3,12 **** // // Author: ! // Sebastien Pouliot (spo...@mo...) // // (C) 2003 Motus Technologies Inc. (http://www.motus.com) // using System; using System.Text; --- 3,14 ---- // // Author: ! // Sebastien Pouliot <seb...@xi...> // // (C) 2003 Motus Technologies Inc. (http://www.motus.com) + // (C) 2004 Novell (http://www.novell.com) // using System; + using System.Globalization; using System.Text; *************** *** 27,31 **** * } */ ! internal class BasicConstraintsExtension : X509Extension { private bool cA; --- 29,38 ---- * } */ ! #if INSIDE_CORLIB ! internal ! #else ! public ! #endif ! class BasicConstraintsExtension : X509Extension { private bool cA; *************** *** 95,99 **** sb.Append ("None"); else ! sb.Append (pathLenConstraint.ToString ()); sb.Append (Environment.NewLine); return sb.ToString (); --- 102,106 ---- sb.Append ("None"); else ! sb.Append (pathLenConstraint.ToString (CultureInfo.InvariantCulture)); sb.Append (Environment.NewLine); return sb.ToString (); Index: KeyUsageExtension.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.X509.Extensions/KeyUsageExtension.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** KeyUsageExtension.cs 5 Mar 2004 23:19:07 -0000 1.1 --- KeyUsageExtension.cs 9 May 2004 12:06:37 -0000 1.2 *************** *** 3,12 **** // // Author: ! // Sebastien Pouliot (spo...@mo...) // // (C) 2003 Motus Technologies Inc. (http://www.motus.com) // using System; using System.Text; --- 3,14 ---- // // Author: ! // Sebastien Pouliot <seb...@xi...> // // (C) 2003 Motus Technologies Inc. (http://www.motus.com) + // (C) 2004 Novell (http://www.novell.com) // using System; + using System.Globalization; using System.Text; *************** *** 33,37 **** // note: because nothing is simple in ASN.1 bits are reversed [Flags] ! internal enum KeyUsage { digitalSignature = 0x80, nonRepudiation = 0x40, --- 35,44 ---- // note: because nothing is simple in ASN.1 bits are reversed [Flags] ! #if INSIDE_CORLIB ! internal ! #else ! public ! #endif ! enum KeyUsages { digitalSignature = 0x80, nonRepudiation = 0x40, *************** *** 46,50 **** } ! internal class KeyUsageExtension : X509Extension { private int kubits; --- 53,62 ---- } ! #if INSIDE_CORLIB ! internal ! #else ! public ! #endif ! class KeyUsageExtension : X509Extension { private int kubits; *************** *** 68,74 **** } ! public bool Support (KeyUsage usage) { ! int x = Convert.ToInt32 (usage); return ((x & kubits) == x); } --- 80,86 ---- } ! public bool Support (KeyUsages usage) { ! int x = Convert.ToInt32 (usage, CultureInfo.InvariantCulture); return ((x & kubits) == x); } *************** *** 78,119 **** const string separator = " , "; StringBuilder sb = new StringBuilder (); ! if (Support (KeyUsage.digitalSignature)) sb.Append ("Digital Signature"); ! if (Support (KeyUsage.nonRepudiation)) { if (sb.Length > 0) sb.Append (separator); sb.Append ("Non-Repudiation"); } ! if (Support (KeyUsage.keyEncipherment)) { if (sb.Length > 0) sb.Append (separator); sb.Append ("Key Encipherment"); } ! if (Support (KeyUsage.dataEncipherment)) { if (sb.Length > 0) sb.Append (separator); sb.Append ("Data Encipherment"); } ! if (Support (KeyUsage.keyAgreement)) { if (sb.Length > 0) sb.Append (separator); sb.Append ("Key Agreement"); } ! if (Support (KeyUsage.keyCertSign)) { if (sb.Length > 0) sb.Append (separator); sb.Append ("Certificate Signing"); } ! if (Support (KeyUsage.cRLSign)) { if (sb.Length > 0) sb.Append (separator); sb.Append ("CRL Signing"); } ! if (Support (KeyUsage.encipherOnly)) { if (sb.Length > 0) sb.Append (separator); sb.Append ("Encipher Only "); // ??? } ! if (Support (KeyUsage.decipherOnly)) { if (sb.Length > 0) sb.Append (separator); --- 90,131 ---- const string separator = " , "; StringBuilder sb = new StringBuilder (); ! if (Support (KeyUsages.digitalSignature)) sb.Append ("Digital Signature"); ! if (Support (KeyUsages.nonRepudiation)) { if (sb.Length > 0) sb.Append (separator); sb.Append ("Non-Repudiation"); } ! if (Support (KeyUsages.keyEncipherment)) { if (sb.Length > 0) sb.Append (separator); sb.Append ("Key Encipherment"); } ! if (Support (KeyUsages.dataEncipherment)) { if (sb.Length > 0) sb.Append (separator); sb.Append ("Data Encipherment"); } ! if (Support (KeyUsages.keyAgreement)) { if (sb.Length > 0) sb.Append (separator); sb.Append ("Key Agreement"); } ! if (Support (KeyUsages.keyCertSign)) { if (sb.Length > 0) sb.Append (separator); sb.Append ("Certificate Signing"); } ! if (Support (KeyUsages.cRLSign)) { if (sb.Length > 0) sb.Append (separator); sb.Append ("CRL Signing"); } ! if (Support (KeyUsages.encipherOnly)) { if (sb.Length > 0) sb.Append (separator); sb.Append ("Encipher Only "); // ??? } ! if (Support (KeyUsages.decipherOnly)) { if (sb.Length > 0) sb.Append (separator); *************** *** 121,125 **** } sb.Append ("("); ! sb.Append (kubits.ToString ("X2")); sb.Append (")"); sb.Append (Environment.NewLine); --- 133,137 ---- } sb.Append ("("); ! sb.Append (kubits.ToString ("X2", CultureInfo.InvariantCulture)); sb.Append (")"); sb.Append (Environment.NewLine); |