From: <car...@us...> - 2006-03-13 13:24:58
|
Revision: 17 Author: carlosga_fb Date: 2006-03-13 05:24:41 -0800 (Mon, 13 Mar 2006) ViewCVS: http://svn.sourceforge.net/pgsqlclient/?rev=17&view=rev Log Message: ----------- Modified Paths: -------------- pgsqlclient/source/PostgreSql.Data.PostgreSqlClient.suo pgsqlclient/source/SecureSocketLayer/SecureSocketLayer.csproj pgsqlclient/source/SecureSocketLayer/SecureSocketLayer.csproj.user Removed Paths: ------------- pgsqlclient/source/SecureSocketLayer/Mono/Security/X509/X509CRL.cs pgsqlclient/source/SecureSocketLayer/Mono/Security/X509/X509Store.cs pgsqlclient/source/SecureSocketLayer/Mono/Security/X509/X509StoreManager.cs pgsqlclient/source/SecureSocketLayer/Mono/Security/X509/X509Stores.cs Modified: pgsqlclient/source/PostgreSql.Data.PostgreSqlClient.suo =================================================================== (Binary files differ) Deleted: pgsqlclient/source/SecureSocketLayer/Mono/Security/X509/X509CRL.cs =================================================================== --- pgsqlclient/source/SecureSocketLayer/Mono/Security/X509/X509CRL.cs 2006-03-13 13:24:04 UTC (rev 16) +++ pgsqlclient/source/SecureSocketLayer/Mono/Security/X509/X509CRL.cs 2006-03-13 13:24:41 UTC (rev 17) @@ -1,405 +0,0 @@ -// -// X509CRL.cs: Handles X.509 certificates revocation lists. -// -// Author: -// Sebastien Pouliot <seb...@xi...> -// -// (C) 2004 Novell (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 -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections; -using System.Globalization; -using System.IO; -using System.Security.Cryptography; - -using Mono.Security.X509.Extensions; - -namespace Mono.Security.X509 { - /* - * CertificateList ::= SEQUENCE { - * tbsCertList TBSCertList, - * signatureAlgorithm AlgorithmIdentifier, - * signature BIT STRING - * } - * - * TBSCertList ::= SEQUENCE { - * version Version OPTIONAL, - * -- if present, MUST be v2 - * signature AlgorithmIdentifier, - * issuer Name, - * thisUpdate Time, - * nextUpdate Time OPTIONAL, - * revokedCertificates SEQUENCE OF SEQUENCE { - * userCertificate CertificateSerialNumber, - * revocationDate Time, - * crlEntryExtensions Extensions OPTIONAL - * -- if present, MUST be v2 - * } OPTIONAL, - * crlExtensions [0] Extensions OPTIONAL } - * -- if present, MUST be v2 - */ -#if INSIDE_CORLIB - internal -#else - public -#endif - class X509Crl { - - public class X509CrlEntry { - - private byte[] sn; - private DateTime revocationDate; - private X509ExtensionCollection extensions; - - internal X509CrlEntry (byte[] serialNumber, DateTime revocationDate, X509ExtensionCollection extensions) - { - sn = serialNumber; - this.revocationDate = revocationDate; - if (extensions == null) - this.extensions = new X509ExtensionCollection (); - else - this.extensions = extensions; - } - - internal X509CrlEntry (ASN1 entry) - { - sn = entry [0].Value; - Array.Reverse (sn); - revocationDate = ASN1Convert.ToDateTime (entry [1]); - extensions = new X509ExtensionCollection (entry [2]); - } - - public byte[] SerialNumber { - get { return (byte[]) sn.Clone (); } - } - - public DateTime RevocationDate { - get { return revocationDate; } - } - - public X509ExtensionCollection Extensions { - get { return extensions; } - } - - public byte[] GetBytes () - { - ASN1 sequence = new ASN1 (0x30); - sequence.Add (new ASN1 (0x02, sn)); - sequence.Add (ASN1Convert.FromDateTime (revocationDate)); - if (extensions.Count > 0) - sequence.Add (new ASN1 (extensions.GetBytes ())); - return sequence.GetBytes (); - } - } - - private string issuer; - private byte version; - private DateTime thisUpdate; - private DateTime nextUpdate; - private ArrayList entries; - private string signatureOID; - private byte[] signature; - private X509ExtensionCollection extensions; - private byte[] encoded; - - public X509Crl (byte[] crl) - { - if (crl == null) - throw new ArgumentNullException ("crl"); - encoded = (byte[]) crl.Clone (); - Parse (encoded); - } - - private void Parse (byte[] crl) - { - string e = "Input data cannot be coded as a valid CRL."; - try { - // CertificateList ::= SEQUENCE { - ASN1 encodedCRL = new ASN1 (encoded); - if ((encodedCRL.Tag != 0x30) || (encodedCRL.Count != 3)) - throw new CryptographicException (e); - - // CertificateList / TBSCertList, - ASN1 toBeSigned = encodedCRL [0]; - if ((toBeSigned.Tag != 0x30) || (toBeSigned.Count < 3)) - throw new CryptographicException (e); - - int n = 0; - // CertificateList / TBSCertList / Version OPTIONAL, -- if present, MUST be v2 - if (toBeSigned [n].Tag == 0x02) { - version = (byte) (toBeSigned [n++].Value [0] + 1); - } - else - version = 1; // DEFAULT - // CertificateList / TBSCertList / AlgorithmIdentifier, - signatureOID = ASN1Convert.ToOid (toBeSigned [n++][0]); - // CertificateList / TBSCertList / Name, - issuer = X501.ToString (toBeSigned [n++]); - // CertificateList / TBSCertList / Time, - thisUpdate = ASN1Convert.ToDateTime (toBeSigned [n++]); - // CertificateList / TBSCertList / Time OPTIONAL, - ASN1 next = toBeSigned [n++]; - if ((next.Tag == 0x17) || (next.Tag == 0x18)) { - nextUpdate = ASN1Convert.ToDateTime (next); - next = toBeSigned [n++]; - } - // CertificateList / TBSCertList / revokedCertificates SEQUENCE OF SEQUENCE { - entries = new ArrayList (); - ASN1 revokedCertificates = next; - for (int i=0; i < revokedCertificates.Count; i++) { - entries.Add (new X509CrlEntry (revokedCertificates [i])); - } - // CertificateList / TBSCertList / crlExtensions [0] Extensions OPTIONAL } - ASN1 extns = toBeSigned [n]; - if ((extns != null) && (extns.Tag == 0xA0) && (extns.Count == 1)) - extensions = new X509ExtensionCollection (extns [0]); - else - extensions = new X509ExtensionCollection (null); // result in a read only object - // CertificateList / AlgorithmIdentifier - string signatureAlgorithm = ASN1Convert.ToOid (encodedCRL [1][0]); - if (signatureOID != signatureAlgorithm) - throw new CryptographicException (e + " [Non-matching signature algorithms in CRL]"); - - // CertificateList / BIT STRING - byte[] bitstring = encodedCRL [2].Value; - // first byte contains unused bits in first byte - signature = new byte [bitstring.Length - 1]; - Buffer.BlockCopy (bitstring, 1, signature, 0, signature.Length); - } - catch { - throw new CryptographicException (e); - } - } - - public ArrayList Entries { - get { return ArrayList.ReadOnly (entries); } - } - - public X509CrlEntry this [int index] { - get { return (X509CrlEntry) entries [index]; } - } - - public X509CrlEntry this [byte[] serialNumber] { - get { return GetCrlEntry (serialNumber); } - } - - public X509ExtensionCollection Extensions { - get { return extensions; } - } - - public string IssuerName { - get { return issuer; } - } - - public DateTime NextUpdate { - get { return nextUpdate; } - } - - public DateTime ThisUpdate { - get { return thisUpdate; } - } - - public string SignatureAlgorithm { - get { return signatureOID; } - } - - public byte[] Signature { - get { - if (signature == null) - return null; - return (byte[]) signature.Clone (); - } - } - - public byte Version { - get { return version; } - } - - public bool IsCurrent { - get { return WasCurrent (DateTime.UtcNow); } - } - - public bool WasCurrent (DateTime instant) - { - if (nextUpdate == DateTime.MinValue) - return (instant >= thisUpdate); - else - return ((instant >= thisUpdate) && (instant <= nextUpdate)); - } - - public byte[] GetBytes () - { - return (byte[]) encoded.Clone (); - } - - private bool Compare (byte[] array1, byte[] array2) - { - if ((array1 == null) && (array2 == null)) - return true; - if ((array1 == null) || (array2 == null)) - return false; - if (array1.Length != array2.Length) - return false; - for (int i=0; i < array1.Length; i++) { - if (array1 [i] != array2 [i]) - return false; - } - return true; - } - - public X509CrlEntry GetCrlEntry (X509Certificate x509) - { - if (x509 == null) - throw new ArgumentNullException ("x509"); - - return GetCrlEntry (x509.SerialNumber); - } - - public X509CrlEntry GetCrlEntry (byte[] serialNumber) - { - if (serialNumber == null) - throw new ArgumentNullException ("serialNumber"); - - for (int i=0; i < entries.Count; i++) { - X509CrlEntry entry = (X509CrlEntry) entries [i]; - if (Compare (serialNumber, entry.SerialNumber)) - return entry; - } - return null; - } - - public bool VerifySignature (X509Certificate x509) - { - if (x509 == null) - throw new ArgumentNullException ("x509"); - - // 1. x509 certificate must be a CA certificate (unknown for v1 or v2 certs) - if (x509.Version >= 3) { - // 1.1. Check for "cRLSign" bit in KeyUsage extension - X509Extension ext = x509.Extensions ["2.5.29.15"]; - if (ext != null) { - KeyUsageExtension keyUsage = new KeyUsageExtension (ext); - if (!keyUsage.Support (KeyUsages.cRLSign)) - return false; - } - // 1.2. Check for ca = true in BasicConstraint - ext = x509.Extensions ["2.5.29.19"]; - if (ext != null) { - BasicConstraintsExtension basicConstraints = new BasicConstraintsExtension (ext); - if (!basicConstraints.CertificateAuthority) - return false; - } - } - // 2. CRL issuer must match CA subject name - if (issuer != x509.SubjectName) - return false; - // 3. Check the CRL signature with the CA certificate public key - switch (signatureOID) { - case "1.2.840.10040.4.3": - return VerifySignature (x509.DSA); - default: - return VerifySignature (x509.RSA); - } - } - - private byte[] GetHash (string hashName) - { - ASN1 encodedCRL = new ASN1 (encoded); - byte[] toBeSigned = encodedCRL [0].GetBytes (); - HashAlgorithm ha = HashAlgorithm.Create (hashName); - return ha.ComputeHash (toBeSigned); - } - - internal bool VerifySignature (DSA dsa) - { - if (signatureOID != "1.2.840.10040.4.3") - throw new CryptographicException ("Unsupported hash algorithm: " + signatureOID); - DSASignatureDeformatter v = new DSASignatureDeformatter (dsa); - // only SHA-1 is supported - string hashName = "SHA1"; - v.SetHashAlgorithm (hashName); - ASN1 sign = new ASN1 (signature); - if ((sign == null) || (sign.Count != 2)) - return false; - // parts may be less than 20 bytes (i.e. first bytes were 0x00) - byte[] part1 = sign [0].Value; - byte[] part2 = sign [1].Value; - byte[] sig = new byte [40]; - Buffer.BlockCopy (part1, 0, sig, (20 - part1.Length), part1.Length); - Buffer.BlockCopy (part2, 0, sig, (40 - part2.Length), part2.Length); - return v.VerifySignature (GetHash (hashName), sig); - } - - internal bool VerifySignature (RSA rsa) - { - RSAPKCS1SignatureDeformatter v = new RSAPKCS1SignatureDeformatter (rsa); - string hashName = null; - switch (signatureOID) { - // MD2 with RSA encryption - case "1.2.840.113549.1.1.2": - // maybe someone installed MD2 ? - hashName = "MD2"; - break; - // MD5 with RSA encryption - case "1.2.840.113549.1.1.4": - hashName = "MD5"; - break; - // SHA-1 with RSA Encryption - case "1.2.840.113549.1.1.5": - hashName = "SHA1"; - break; - default: - throw new CryptographicException ("Unsupported hash algorithm: " + signatureOID); - } - v.SetHashAlgorithm (hashName); - return v.VerifySignature (GetHash (hashName), signature); - } - - public bool VerifySignature (AsymmetricAlgorithm aa) - { - if (aa == null) - throw new ArgumentNullException ("aa"); - - // only validate the signature (in case we don't have the CA certificate) - if (aa is RSA) - return VerifySignature (aa as RSA); - else if (aa is DSA) - return VerifySignature (aa as DSA); - else - throw new NotSupportedException ("Unknown Asymmetric Algorithm " + aa.ToString ()); - } - - static public X509Crl CreateFromFile (string filename) - { - byte[] crl = null; - using (FileStream fs = File.Open (filename, FileMode.Open, FileAccess.Read, FileShare.Read)) { - crl = new byte [fs.Length]; - fs.Read (crl, 0, crl.Length); - fs.Close (); - } - return new X509Crl (crl); - } - } -} Deleted: pgsqlclient/source/SecureSocketLayer/Mono/Security/X509/X509Store.cs =================================================================== --- pgsqlclient/source/SecureSocketLayer/Mono/Security/X509/X509Store.cs 2006-03-13 13:24:04 UTC (rev 16) +++ pgsqlclient/source/SecureSocketLayer/Mono/Security/X509/X509Store.cs 2006-03-13 13:24:41 UTC (rev 17) @@ -1,244 +0,0 @@ -// -// X509Store.cs: Handles a X.509 certificates/CRLs store -// -// Author: -// Sebastien Pouliot <seb...@xi...> -// -// Copyright (C) 2004 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 -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections; -using System.Globalization; -using System.IO; -using System.Text; - -using Mono.Security.X509.Extensions; - -namespace Mono.Security.X509 { - -#if INSIDE_CORLIB - internal -#else - public -#endif - class X509Store { - - private string _storePath; - private X509CertificateCollection _certificates; - private ArrayList _crls; - private bool _crl; - private string _name; - - internal X509Store (string path, bool crl) - { - _storePath = path; - _crl = crl; - } - - // properties - - public X509CertificateCollection Certificates { - get { - if (_certificates == null) { - _certificates = BuildCertificatesCollection (_storePath); - } - return _certificates; - } - } - - public ArrayList Crls { - get { - // CRL aren't applicable to all stores - // but returning null is a little rude - if (!_crl) { - _crls = new ArrayList (); - } - if (_crls == null) { - _crls = BuildCrlsCollection (_storePath); - } - return _crls; - } - } - - public string Name { - get { - if (_name == null) { - int n = _storePath.LastIndexOf (Path.DirectorySeparatorChar); - _name = _storePath.Substring (n+1); - } - return _name; - } - } - - // methods - - public void Clear () - { - if (_certificates != null) - _certificates.Clear (); - _certificates = null; - if (_crls != null) - _crls.Clear (); - _crls = null; - } - - public void Import (X509Certificate certificate) - { - CheckStore (_storePath, true); - - string filename = Path.Combine (_storePath, GetUniqueName (certificate)); - if (!File.Exists (filename)) { - using (FileStream fs = File.OpenWrite (filename)) { - byte[] data = certificate.RawData; - fs.Write (data, 0, data.Length); - fs.Close (); - } - } - } - - public void Remove (X509Certificate certificate) - { - string filename = Path.Combine (_storePath, GetUniqueName (certificate)); - if (File.Exists (filename)) { - File.Delete (filename); - } - } - - // private stuff - - private string GetUniqueName (X509Certificate certificate) - { - string method = null; - byte[] name = null; - - // We prefer Subject Key Identifier as the unique name - // as it will provide faster lookups - X509Extension ext = certificate.Extensions ["2.5.29.14"]; - if (ext != null) { - SubjectKeyIdentifierExtension ski = new SubjectKeyIdentifierExtension (ext); - name = ski.Identifier; - method = "ski"; - } - else { - method = "tbp"; // thumbprint - name = certificate.Hash; - } - - StringBuilder sb = new StringBuilder (method); - sb.Append ("-"); - foreach (byte b in name) { - sb.Append (b.ToString ("X2", CultureInfo.InvariantCulture)); - } - sb.Append (".cer"); - - return sb.ToString (); - } - - private byte[] Load (string filename) - { - byte[] data = null; - using (FileStream fs = File.OpenRead (filename)) { - data = new byte [fs.Length]; - fs.Read (data, 0, data.Length); - fs.Close (); - } - return data; - } - - private X509Certificate LoadCertificate (string filename) - { - byte[] data = Load (filename); - X509Certificate cert = new X509Certificate (data); - return cert; - } - - private X509Crl LoadCrl (string filename) - { - byte[] data = Load (filename); - X509Crl crl = new X509Crl (data); - return crl; - } - - private bool CheckStore (string path, bool throwException) - { - try { - if (Directory.Exists (path)) - return true; - Directory.CreateDirectory (path); - return Directory.Exists (path); - } - catch { - if (throwException) - throw; - return false; - } - } - - private X509CertificateCollection BuildCertificatesCollection (string storeName) - { - X509CertificateCollection coll = new X509CertificateCollection (); - string path = Path.Combine (_storePath, storeName); - if (!CheckStore (path, false)) - return coll; // empty collection - - string[] files = Directory.GetFiles (path, "*.cer"); - if ((files != null) && (files.Length > 0)) { - foreach (string file in files) { - try { - X509Certificate cert = LoadCertificate (file); - coll.Add (cert); - } - catch { - // in case someone is dumb enough - // (like me) to include a base64 - // encoded certs (or other junk - // into the store). - } - } - } - return coll; - } - - private ArrayList BuildCrlsCollection (string storeName) - { - ArrayList list = new ArrayList (); - string path = Path.Combine (_storePath, storeName); - if (!CheckStore (path, false)) - return list; // empty list - - string[] files = Directory.GetFiles (path, "*.crl"); - if ((files != null) && (files.Length > 0)) { - foreach (string file in files) { - try { - X509Crl crl = LoadCrl (file); - list.Add (crl); - } - catch { - // junk catcher - } - } - } - return list; - } - } -} Deleted: pgsqlclient/source/SecureSocketLayer/Mono/Security/X509/X509StoreManager.cs =================================================================== --- pgsqlclient/source/SecureSocketLayer/Mono/Security/X509/X509StoreManager.cs 2006-03-13 13:24:04 UTC (rev 16) +++ pgsqlclient/source/SecureSocketLayer/Mono/Security/X509/X509StoreManager.cs 2006-03-13 13:24:41 UTC (rev 17) @@ -1,130 +0,0 @@ -// -// X509StoreManager.cs: X.509 store manager. -// -// Author: -// Sebastien Pouliot <seb...@xi...> -// -// (C) 2004 Novell (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 -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections; -using System.IO; - -using Mono.Security.X509.Extensions; - -namespace Mono.Security.X509 { - -#if INSIDE_CORLIB - internal -#else - public -#endif - sealed class X509StoreManager { - - static private X509Stores _userStore; - static private X509Stores _machineStore; - - private X509StoreManager () - { - } - - static public X509Stores CurrentUser { - get { - if (_userStore == null) { - string _userPath = Path.Combine ( - Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), - ".mono"); - _userPath = Path.Combine (_userPath, "certs"); - - _userStore = new X509Stores (_userPath); - } - return _userStore; - } - } - - static public X509Stores LocalMachine { - get { - if (_machineStore == null) { - string _machinePath = Path.Combine ( - Environment.GetFolderPath (Environment.SpecialFolder.CommonApplicationData), - ".mono"); - _machinePath = Path.Combine (_machinePath, "certs"); - - _machineStore = new X509Stores (_machinePath); - } - return _machineStore; - } - } - - // Merged stores collections - // we need to look at both the user and the machine (entreprise) - // certificates/CRLs when building/validating a chain - - static public X509CertificateCollection IntermediateCACertificates { - get { - X509CertificateCollection intermediateCerts = new X509CertificateCollection (); - intermediateCerts.AddRange (CurrentUser.IntermediateCA.Certificates); - intermediateCerts.AddRange (LocalMachine.IntermediateCA.Certificates); - return intermediateCerts; - } - } - - static public ArrayList IntermediateCACrls { - get { - ArrayList intermediateCRLs = new ArrayList (); - intermediateCRLs.AddRange (CurrentUser.IntermediateCA.Crls); - intermediateCRLs.AddRange (LocalMachine.IntermediateCA.Crls); - return intermediateCRLs; - } - } - - static public X509CertificateCollection TrustedRootCertificates { - get { - X509CertificateCollection trustedCerts = new X509CertificateCollection (); - trustedCerts.AddRange (CurrentUser.TrustedRoot.Certificates); - trustedCerts.AddRange (LocalMachine.TrustedRoot.Certificates); - return trustedCerts; - } - } - - static public ArrayList TrustedRootCACrls { - get { - ArrayList trustedCRLs = new ArrayList (); - trustedCRLs.AddRange (CurrentUser.TrustedRoot.Crls); - trustedCRLs.AddRange (LocalMachine.TrustedRoot.Crls); - return trustedCRLs; - } - } - - static public X509CertificateCollection UntrustedCertificates { - get { - X509CertificateCollection untrustedCerts = new X509CertificateCollection (); - untrustedCerts.AddRange (CurrentUser.Untrusted.Certificates); - untrustedCerts.AddRange (LocalMachine.Untrusted.Certificates); - return untrustedCerts; - } - } - } -} Deleted: pgsqlclient/source/SecureSocketLayer/Mono/Security/X509/X509Stores.cs =================================================================== --- pgsqlclient/source/SecureSocketLayer/Mono/Security/X509/X509Stores.cs 2006-03-13 13:24:04 UTC (rev 16) +++ pgsqlclient/source/SecureSocketLayer/Mono/Security/X509/X509Stores.cs 2006-03-13 13:24:41 UTC (rev 17) @@ -1,146 +0,0 @@ -// -// X509Stores.cs: Handles X.509 certificates/CRLs stores group. -// -// Author: -// Sebastien Pouliot <seb...@xi...> -// -// (C) 2004 Novell (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 -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections; -using System.IO; - -using Mono.Security.X509.Extensions; - -namespace Mono.Security.X509 { - -#if INSIDE_CORLIB - internal -#else - public -#endif - class X509Stores { - - private string _storePath; - private X509Store _personal; - private X509Store _other; - private X509Store _intermediate; - private X509Store _trusted; - private X509Store _untrusted; - - internal X509Stores (string path) - { - _storePath = path; - } - - // properties - - public X509Store Personal { - get { - if (_personal == null) { - string path = Path.Combine (_storePath, Names.Personal); - _personal = new X509Store (path, false); - } - return _personal; - } - } - - public X509Store OtherPeople { - get { - if (_other == null) { - string path = Path.Combine (_storePath, Names.OtherPeople); - _other = new X509Store (path, false); - } - return _other; - } - } - - public X509Store IntermediateCA { - get { - if (_intermediate == null) { - string path = Path.Combine (_storePath, Names.IntermediateCA); - _intermediate = new X509Store (path, true); - } - return _intermediate; - } - } - - public X509Store TrustedRoot { - get { - if (_trusted == null) { - string path = Path.Combine (_storePath, Names.TrustedRoot); - _trusted = new X509Store (path, true); - } - return _trusted; - } - } - - public X509Store Untrusted { - get { - if (_untrusted == null) { - string path = Path.Combine (_storePath, Names.Untrusted); - _untrusted = new X509Store (path, false); - } - return _untrusted; - } - } - - // methods - - public void Clear () - { - // this will force a reload of all stores - if (_personal != null) - _personal.Clear (); - _personal = null; - if (_other != null) - _other.Clear (); - _other = null; - if (_intermediate != null) - _intermediate.Clear (); - _intermediate = null; - if (_trusted != null) - _trusted.Clear (); - _trusted = null; - if (_untrusted != null) - _untrusted.Clear (); - _untrusted = null; - } - - // names - - public class Names { - - // do not translate - public const string Personal = "My"; - public const string OtherPeople = "AddressBook"; - public const string IntermediateCA = "CA"; - public const string TrustedRoot = "Trust"; - public const string Untrusted = "Disallowed"; - - public Names () {} - } - } -} Modified: pgsqlclient/source/SecureSocketLayer/SecureSocketLayer.csproj =================================================================== --- pgsqlclient/source/SecureSocketLayer/SecureSocketLayer.csproj 2006-03-13 13:24:04 UTC (rev 16) +++ pgsqlclient/source/SecureSocketLayer/SecureSocketLayer.csproj 2006-03-13 13:24:41 UTC (rev 17) @@ -140,42 +140,6 @@ <SubType>Code</SubType> </Compile> <Compile Include="Mono\Security\StrongName.cs" /> - <Compile Include="Mono\Security\X509\Extensions\AuthorityKeyIdentifierExtension.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="Mono\Security\X509\Extensions\BasicConstraintsExtension.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="Mono\Security\X509\Extensions\CertificatePoliciesExtension.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="Mono\Security\X509\Extensions\CRLDistributionPointsExtension.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="Mono\Security\X509\Extensions\ExtendedKeyUsageExtension.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="Mono\Security\X509\Extensions\GeneralNames.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="Mono\Security\X509\Extensions\KeyAttributesExtension.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="Mono\Security\X509\Extensions\KeyUsageExtension.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="Mono\Security\X509\Extensions\NetscapeCertTypeExtension.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="Mono\Security\X509\Extensions\PrivateKeyUsagePeriodExtension.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="Mono\Security\X509\Extensions\SubjectAltNameExtension.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="Mono\Security\X509\Extensions\SubjectKeyIdentifierExtension.cs"> - <SubType>Code</SubType> - </Compile> <Compile Include="Mono\Security\X509\ITrustAnchors.cs"> <SubType>Code</SubType> </Compile> @@ -200,24 +164,12 @@ <Compile Include="Mono\Security\X509\X509CertificateCollection.cs"> <SubType>Code</SubType> </Compile> - <Compile Include="Mono\Security\X509\X509CRL.cs"> - <SubType>Code</SubType> - </Compile> <Compile Include="Mono\Security\X509\X509Extension.cs"> <SubType>Code</SubType> </Compile> <Compile Include="Mono\Security\X509\X509Extensions.cs"> <SubType>Code</SubType> </Compile> - <Compile Include="Mono\Security\X509\X509Store.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="Mono\Security\X509\X509StoreManager.cs"> - <SubType>Code</SubType> - </Compile> - <Compile Include="Mono\Security\X509\X509Stores.cs"> - <SubType>Code</SubType> - </Compile> <Compile Include="Mono\Security\X509\X520Attributes.cs"> <SubType>Code</SubType> </Compile> Modified: pgsqlclient/source/SecureSocketLayer/SecureSocketLayer.csproj.user =================================================================== --- pgsqlclient/source/SecureSocketLayer/SecureSocketLayer.csproj.user 2006-03-13 13:24:04 UTC (rev 16) +++ pgsqlclient/source/SecureSocketLayer/SecureSocketLayer.csproj.user 2006-03-13 13:24:41 UTC (rev 17) @@ -12,5 +12,6 @@ <ApplicationRevision>0</ApplicationRevision> <FallbackCulture>en-US</FallbackCulture> <VerifyUploadedFiles>false</VerifyUploadedFiles> + <ProjectView>ShowAllFiles</ProjectView> </PropertyGroup> </Project> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |