[pgsqlclient-checkins] pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.X509.Extensions CRLD
Status: Inactive
Brought to you by:
carlosga_fb
From: Carlos G. Á. <car...@us...> - 2005-04-04 21:11:31
|
Update of /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.X509.Extensions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1823/Mono.Security.X509.Extensions Modified Files: CRLDistributionPointsExtension.cs SubjectAltNameExtension.cs Log Message: Update with the same sources existente in the Mono SVN Index: SubjectAltNameExtension.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.X509.Extensions/SubjectAltNameExtension.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SubjectAltNameExtension.cs 20 Jul 2004 17:46:47 -0000 1.3 --- SubjectAltNameExtension.cs 4 Apr 2005 21:10:54 -0000 1.4 *************** *** 6,12 **** // // (C) 2003 Motus Technologies Inc. (http://www.motus.com) ! // (C) 2004 Novell (http://www.novell.com) ! // ! // // Permission is hereby granted, free of charge, to any person obtaining --- 6,10 ---- // // (C) 2003 Motus Technologies Inc. (http://www.motus.com) ! // Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining *************** *** 73,88 **** public class SubjectAltNameExtension : X509Extension { ! private ArrayList rfc822Name; ! private ArrayList dnsName; ! private ArrayList ipAddr; ! public SubjectAltNameExtension () : base () { extnOid = "2.5.29.17"; } ! public SubjectAltNameExtension (ASN1 asn1) : base (asn1) {} ! public SubjectAltNameExtension (X509Extension extension) : base (extension) {} protected override void Decode () --- 71,91 ---- public class SubjectAltNameExtension : X509Extension { ! private GeneralNames _names; ! public SubjectAltNameExtension () { extnOid = "2.5.29.17"; + _names = new GeneralNames (); } ! public SubjectAltNameExtension (ASN1 asn1) ! : base (asn1) ! { ! } ! public SubjectAltNameExtension (X509Extension extension) ! : base (extension) ! { ! } protected override void Decode () *************** *** 91,115 **** if (sequence.Tag != 0x30) throw new ArgumentException ("Invalid SubjectAltName extension"); ! for (int i=0; i < sequence.Count; i++) { ! switch (sequence [i].Tag) { ! case 0x81: // rfc822Name [1] IA5String ! if (rfc822Name == null) ! rfc822Name = new ArrayList (); ! rfc822Name.Add (Encoding.ASCII.GetString (sequence [i].Value)); ! break; ! case 0x82: // dNSName [2] IA5String ! if (dnsName == null) ! dnsName = new ArrayList (); ! dnsName.Add (Encoding.ASCII.GetString (sequence [i].Value)); ! break; ! case 0x87: // iPAddress [7] OCTET STRING ! if (ipAddr == null) ! ipAddr = new ArrayList (); ! // TODO - Must find sample certificates ! break; ! default: ! break; ! } ! } } --- 94,98 ---- if (sequence.Tag != 0x30) throw new ArgumentException ("Invalid SubjectAltName extension"); ! _names = new GeneralNames (sequence); } *************** *** 119,171 **** public string[] RFC822 { ! get { ! if (rfc822Name == null) ! return new string [0]; ! return (string[]) rfc822Name.ToArray (typeof(string)); ! } } public string[] DNSNames { ! get { ! if (dnsName == null) ! return new string [0]; ! return (string[]) dnsName.ToArray (typeof(string)); ! } } // Incomplete support public string[] IPAddresses { ! get { ! if (ipAddr == null) ! return new string [0]; ! return (string[]) ipAddr.ToArray (typeof(string)); ! } } public override string ToString () { ! StringBuilder sb = new StringBuilder (); ! if (rfc822Name != null) { ! foreach (string s in rfc822Name) { ! sb.Append ("RFC822 Name="); ! sb.Append (s); ! sb.Append (Environment.NewLine); ! } ! } ! if (dnsName != null) { ! foreach (string s in dnsName) { ! sb.Append ("DNS Name="); ! sb.Append (s); ! sb.Append (Environment.NewLine); ! } ! } ! if (ipAddr != null) { ! foreach (string s in ipAddr) { ! sb.Append ("IP Address="); ! sb.Append (s); ! sb.Append (Environment.NewLine); ! } ! } ! return sb.ToString (); } } --- 102,120 ---- public string[] RFC822 { ! get { return _names.RFC822; } } public string[] DNSNames { ! get { return _names.DNSNames; } } // Incomplete support public string[] IPAddresses { ! get { return _names.IPAddresses; } } public override string ToString () { ! return _names.ToString (); } } Index: CRLDistributionPointsExtension.cs =================================================================== RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/Mono.Security/Mono.Security/Mono.Security.X509.Extensions/CRLDistributionPointsExtension.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CRLDistributionPointsExtension.cs 20 Jul 2004 17:46:47 -0000 1.4 --- CRLDistributionPointsExtension.cs 4 Apr 2005 21:10:53 -0000 1.5 *************** *** 85,92 **** CRLIssuer = issuer; } } [Flags] ! public enum ReasonFlags { Unused = 0, KeyCompromise = 1, --- 85,114 ---- CRLIssuer = issuer; } + + public DP (ASN1 dp) + { + for (int i = 0; i < dp.Count; i++) { + ASN1 el = dp[i]; + switch (el.Tag) { + case 0xA0: // DistributionPointName OPTIONAL + for (int j = 0; j < el.Count; j++) { + ASN1 dpn = el [j]; + if (dpn.Tag == 0xA0) { + DistributionPoint = new GeneralNames (dpn).ToString (); + } + } + break; + case 0xA1: // ReasonFlags OPTIONAL + break; + case 0xA2: // RelativeDistinguishedName + break; + } + } + } } [Flags] ! public enum ReasonFlags ! { Unused = 0, KeyCompromise = 1, *************** *** 108,114 **** } ! public CRLDistributionPointsExtension (ASN1 asn1) : base (asn1) {} ! public CRLDistributionPointsExtension (X509Extension extension) : base (extension) {} protected override void Decode () --- 130,142 ---- } ! public CRLDistributionPointsExtension (ASN1 asn1) ! : base (asn1) ! { ! } ! public CRLDistributionPointsExtension (X509Extension extension) ! : base (extension) ! { ! } protected override void Decode () *************** *** 120,124 **** // for every distribution point for (int i=0; i < sequence.Count; i++) { ! dps.Add (null); } } --- 148,152 ---- // for every distribution point for (int i=0; i < sequence.Count; i++) { ! dps.Add (new DP (sequence [i])); } } *************** *** 131,146 **** { StringBuilder sb = new StringBuilder (); foreach (DP dp in dps) { sb.Append ("["); ! sb.Append (dp.Reasons); sb.Append ("]CRL Distribution Point"); sb.Append (Environment.NewLine); sb.Append ("\tDistribution Point Name:"); - sb.Append (dp.DistributionPoint); - sb.Append (Environment.NewLine); sb.Append ("\t\tFull Name:"); sb.Append (Environment.NewLine); ! sb.Append ("\t\t\tDirectory Address:"); ! sb.Append (dp.CRLIssuer); sb.Append (Environment.NewLine); } --- 159,173 ---- { StringBuilder sb = new StringBuilder (); + int i = 1; foreach (DP dp in dps) { sb.Append ("["); ! sb.Append (i++); sb.Append ("]CRL Distribution Point"); sb.Append (Environment.NewLine); sb.Append ("\tDistribution Point Name:"); sb.Append ("\t\tFull Name:"); sb.Append (Environment.NewLine); ! sb.Append ("\t\t\t"); ! sb.Append (dp.DistributionPoint); sb.Append (Environment.NewLine); } |