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>2004-07-09 06:14:46 +0400
committerSebastien Pouliot <sebastien@ximian.com>2004-07-09 06:14:46 +0400
commit081fb00ba27fdf60672261713321a87c0dcdcf0c (patch)
tree55955b82711ae294347aa67f6ed42e25e6961073 /mcs/class/System.Security/System.Security.Cryptography.Pkcs
parent3a6e1b6b6096d5b827fd0d981e2a715f1f3c6850 (diff)
2004-07-08 Sebastien Pouliot <sebastien@ximian.com>
* Remove old files from Fx 1.2 preview CryptographicAttribute.cs EnvelopedPkcs7.cs Pkcs7Recipient.cs Pkcs7RecipientCollection.cs Pkcs7RecipientEnumerator.cs Pkcs7Signer.cs Pkcs9AttributeCollection.cs Pkcs9AttributeEnumerator.cs RecipientSubType.cs SignedPkcs7.cs svn path=/trunk/mcs/; revision=30911
Diffstat (limited to 'mcs/class/System.Security/System.Security.Cryptography.Pkcs')
-rwxr-xr-xmcs/class/System.Security/System.Security.Cryptography.Pkcs/CryptographicAttribute.cs86
-rwxr-xr-xmcs/class/System.Security/System.Security.Cryptography.Pkcs/EnvelopedPkcs7.cs247
-rwxr-xr-xmcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs7Recipient.cs70
-rwxr-xr-xmcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs7RecipientCollection.cs115
-rwxr-xr-xmcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs7RecipientEnumerator.cs73
-rwxr-xr-xmcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs7Signer.cs120
-rwxr-xr-xmcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9AttributeCollection.cs99
-rwxr-xr-xmcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9AttributeEnumerator.cs73
-rwxr-xr-xmcs/class/System.Security/System.Security.Cryptography.Pkcs/RecipientInfoType.cs7
-rwxr-xr-xmcs/class/System.Security/System.Security.Cryptography.Pkcs/RecipientSubType.cs46
-rwxr-xr-xmcs/class/System.Security/System.Security.Cryptography.Pkcs/SignedPkcs7.cs275
11 files changed, 3 insertions, 1208 deletions
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/CryptographicAttribute.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/CryptographicAttribute.cs
deleted file mode 100755
index 93398cd3697..00000000000
--- a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/CryptographicAttribute.cs
+++ /dev/null
@@ -1,86 +0,0 @@
-//
-// CryptographicAttribute.cs - System.Security.Cryptography.Pkcs.CryptographicAttribute
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.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.
-//
-
-#if NET_2_0
-
-using System;
-using System.Collections;
-
-namespace System.Security.Cryptography.Pkcs {
-
- public class CryptographicAttribute {
-
- private Oid _oid;
- private ArrayList _list;
-
- // constructors
-
- public CryptographicAttribute (Oid oid)
- {
-// FIXME: compatibility with fx 1.2.3400.0
-// if (oid == null)
-// throw new ArgumentNullException ("oid");
-
- _oid = oid;
- _list = new ArrayList ();
- }
-
- public CryptographicAttribute (Oid oid, ArrayList values) : this (oid)
- {
-// FIXME: compatibility with fx 1.2.3400.0
- if (values == null)
- throw new NullReferenceException ();
-// throw new ArgumentNullException ("values");
-
- _list.AddRange (values);
- }
-
- public CryptographicAttribute (Oid oid, object value) : this (oid)
- {
-// FIXME: compatibility with fx 1.2.3400.0
-// if (value == null)
-// throw new ArgumentNullException ("value");
-
- _list.Add (value);
- }
-
- // properties
-
- public Oid Oid {
- get { return _oid; }
- }
-
- public ArrayList Values {
- get { return _list; }
- }
- }
-}
-
-#endif \ No newline at end of file
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/EnvelopedPkcs7.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/EnvelopedPkcs7.cs
deleted file mode 100755
index 9c31b33868f..00000000000
--- a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/EnvelopedPkcs7.cs
+++ /dev/null
@@ -1,247 +0,0 @@
-//
-// EnvelopedPkcs7.cs - System.Security.Cryptography.Pkcs.EnvelopedPkcs7
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.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.
-//
-
-#if NET_2_0
-
-using System;
-using System.Collections;
-using System.Security.Cryptography.X509Certificates;
-using System.Security.Cryptography.Xml;
-using System.Text;
-
-using Mono.Security;
-
-namespace System.Security.Cryptography.Pkcs {
-
- // References
- // a. PKCS #7: Cryptographic Message Syntax, Version 1.5, Section 10
- // http://www.faqs.org/rfcs/rfc2315.html
-
- public class EnvelopedPkcs7 {
-
- private ContentInfo _content;
- private AlgorithmIdentifier _identifier;
- private X509CertificateExCollection _certs;
- private RecipientInfoCollection _recipients;
- private Pkcs9AttributeCollection _uattribs;
- private SubjectIdentifierType _idType;
- private int _version;
-
- // constructors
-
- public EnvelopedPkcs7 ()
- {
- _certs = new X509CertificateExCollection ();
- _recipients = new RecipientInfoCollection ();
- _uattribs = new Pkcs9AttributeCollection ();
- }
-
- public EnvelopedPkcs7 (ContentInfo content) : this ()
- {
- if (content == null)
- throw new ArgumentNullException ("content");
-
- _content = content;
- }
-
- public EnvelopedPkcs7 (ContentInfo contentInfo, AlgorithmIdentifier encryptionAlgorithm)
- : this (contentInfo)
- {
- if (encryptionAlgorithm == null)
- throw new ArgumentNullException ("encryptionAlgorithm");
-
- _identifier = encryptionAlgorithm;
- }
-
- public EnvelopedPkcs7 (SubjectIdentifierType recipientIdentifierType, ContentInfo contentInfo)
- : this (contentInfo)
- {
- _idType = recipientIdentifierType;
- _version = ((_idType == SubjectIdentifierType.SubjectKeyIdentifier) ? 2 : 0);
- }
-
- public EnvelopedPkcs7 (SubjectIdentifierType recipientIdentifierType, ContentInfo contentInfo, AlgorithmIdentifier encryptionAlgorithm)
- : this (contentInfo, encryptionAlgorithm)
- {
- _idType = recipientIdentifierType;
- _version = ((_idType == SubjectIdentifierType.SubjectKeyIdentifier) ? 2 : 0);
- }
-
- // properties
-
- public X509CertificateExCollection Certificates {
- get { return _certs; }
- }
-
- public AlgorithmIdentifier ContentEncryptionAlgorithm {
- get {
- if (_identifier == null)
- _identifier = new AlgorithmIdentifier ();
- return _identifier;
- }
- }
-
- public ContentInfo ContentInfo {
- get {
- if (_content == null) {
- Oid oid = new Oid (PKCS7.Oid.data);
- _content = new ContentInfo (oid, new byte [0]);
- }
- return _content;
- }
- }
-
- public RecipientInfoCollection RecipientInfos {
- get { return _recipients; }
- }
-
- public Pkcs9AttributeCollection UnprotectedAttributes {
- get { return _uattribs; }
- }
-
- public int Version {
- get { return _version; }
- }
-
- // methods
-
- private X509IssuerSerial GetIssuerSerial (string issuer, byte[] serial)
- {
- X509IssuerSerial xis = new X509IssuerSerial ();
- xis.IssuerName = issuer;
- StringBuilder sb = new StringBuilder ();
- foreach (byte b in serial)
- sb.Append (b.ToString ("X2"));
- xis.SerialNumber = sb.ToString ();
- return xis;
- }
-
- [MonoTODO]
- public void Decode (byte[] encodedMessage)
- {
- if (encodedMessage == null)
- throw new ArgumentNullException ("encodedMessage");
-
- PKCS7.ContentInfo ci = new PKCS7.ContentInfo (encodedMessage);
- if (ci.ContentType != PKCS7.Oid.envelopedData)
- throw new Exception ("");
-
- PKCS7.EnvelopedData ed = new PKCS7.EnvelopedData (ci.Content);
-
- Oid oid = new Oid (ed.ContentInfo.ContentType);
- _content = new ContentInfo (oid, new byte [0]); //ed.ContentInfo.Content.Value);
-
- foreach (PKCS7.RecipientInfo ri in ed.RecipientInfos) {
- Oid o = new Oid (ri.Oid);
- AlgorithmIdentifier ai = new AlgorithmIdentifier (o);
- SubjectIdentifier si = null;
- if (ri.SubjectKeyIdentifier != null) {
- si = new SubjectIdentifier (SubjectIdentifierType.SubjectKeyIdentifier, ri.SubjectKeyIdentifier);
- }
- else if ((ri.Issuer != null) && (ri.Serial != null)) {
- X509IssuerSerial xis = GetIssuerSerial (ri.Issuer, ri.Serial);
- si = new SubjectIdentifier (SubjectIdentifierType.IssuerAndSerialNumber, (object)xis);
- }
-
- KeyTransRecipientInfo _keyTrans = new KeyTransRecipientInfo (ri.Key, ai, si, ri.Version);
- _recipients.Add (_keyTrans);
- }
-
- // TODO - Certificates
- // TODO - UnprotectedAttributes
-
- _version = ed.Version;
- }
-
- [MonoTODO]
- public void Decrypt ()
- {
- throw new InvalidOperationException ("not encrypted");
- }
-
- [MonoTODO]
- public void Decrypt (RecipientInfo recipientInfo)
- {
- if (recipientInfo == null)
- throw new ArgumentNullException ("recipientInfo");
- Decrypt ();
- }
-
- [MonoTODO]
- public void Decrypt (RecipientInfo recipientInfo, X509CertificateExCollection extraStore)
- {
- if (recipientInfo == null)
- throw new ArgumentNullException ("recipientInfo");
- if (extraStore == null)
- throw new ArgumentNullException ("extraStore");
- Decrypt ();
- }
-
- [MonoTODO]
- public void Decrypt (X509CertificateExCollection extraStore)
- {
- if (extraStore == null)
- throw new ArgumentNullException ("extraStore");
- Decrypt ();
- }
-
- [MonoTODO]
- public byte[] Encode ()
- {
- throw new InvalidOperationException ("not encrypted");
- }
-
- [MonoTODO]
- public void Encrypt ()
- {
- if ((_content.Content == null) || (_content.Content.Length == 0))
- throw new CryptographicException ("no content to encrypt");
- }
-
- [MonoTODO]
- public void Encrypt (Pkcs7Recipient recipient)
- {
- if (recipient == null)
- throw new ArgumentNullException ("recipient");
- // TODO
- Encrypt ();
- }
-
- [MonoTODO]
- public void Encrypt (Pkcs7RecipientCollection recipients)
- {
- if (recipients == null)
- throw new ArgumentNullException ("recipients");
- // ? foreach on Encrypt Pkcs7Recipient ?
- }
- }
-}
-
-#endif
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs7Recipient.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs7Recipient.cs
deleted file mode 100755
index 6edbc9f9bee..00000000000
--- a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs7Recipient.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-//
-// Pkcs7Recipient.cs - System.Security.Cryptography.Pkcs.Pkcs7Recipient
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.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.
-//
-
-#if NET_2_0
-
-using System;
-using System.Collections;
-using System.Security.Cryptography.X509Certificates;
-
-namespace System.Security.Cryptography.Pkcs {
-
- public class Pkcs7Recipient {
-
- private SubjectIdentifierType _recipient;
- private X509CertificateEx _certificate;
-
- // constructor
-
- public Pkcs7Recipient (SubjectIdentifierType recipientIdentifierType, X509CertificateEx certificate)
- {
- if (certificate == null)
- throw new ArgumentNullException ("certificate");
-
- if (recipientIdentifierType == SubjectIdentifierType.Unknown)
- _recipient = SubjectIdentifierType.IssuerAndSerialNumber;
- else
- _recipient = recipientIdentifierType;
- _certificate = certificate;
- }
-
- // properties
-
- public X509CertificateEx Certificate {
- get { return _certificate; }
- }
-
- public SubjectIdentifierType RecipientIdentifierType {
- get { return _recipient; }
- }
- }
-}
-
-#endif \ No newline at end of file
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs7RecipientCollection.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs7RecipientCollection.cs
deleted file mode 100755
index a671242775e..00000000000
--- a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs7RecipientCollection.cs
+++ /dev/null
@@ -1,115 +0,0 @@
-//
-// Pkcs7RecipientCollection.cs - System.Security.Cryptography.Pkcs.Pkcs7RecipientCollection
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.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.
-//
-
-#if NET_2_0
-
-using System;
-using System.Collections;
-using System.Security.Cryptography.X509Certificates;
-
-namespace System.Security.Cryptography.Pkcs {
-
- public class Pkcs7RecipientCollection : ICollection, IEnumerable {
-
- private ArrayList _list;
-
- // constructors
-
- public Pkcs7RecipientCollection ()
- {
- _list = new ArrayList ();
- }
-
- public Pkcs7RecipientCollection (Pkcs7Recipient recipient) : base ()
- {
- _list.Add (recipient);
- }
-
- public Pkcs7RecipientCollection (SubjectIdentifierType recipientIdentifierType, X509CertificateExCollection certificates) : base ()
- {
- foreach (X509CertificateEx x509 in certificates) {
- Pkcs7Recipient p7r = new Pkcs7Recipient (recipientIdentifierType, x509);
- _list.Add (p7r);
- }
- }
-
- // properties
-
- public int Count {
- get { return _list.Count; }
- }
-
- public bool IsSynchronized {
- get { return _list.IsSynchronized; }
- }
-
- public Pkcs7Recipient this [int index] {
- get { return (Pkcs7Recipient) _list [index]; }
- }
-
- public object SyncRoot {
- get { return _list.SyncRoot; }
- }
-
- // methods
-
- public int Add (Pkcs7Recipient recipient)
- {
- return _list.Add (recipient);
- }
-
- public void CopyTo (Array array, int index)
- {
- _list.CopyTo (array, index);
- }
-
- public void CopyTo (Pkcs7Recipient[] array, int index)
- {
- _list.CopyTo (array, index);
- }
-
- public Pkcs7RecipientEnumerator GetEnumerator ()
- {
- return new Pkcs7RecipientEnumerator (_list);
- }
-
- IEnumerator IEnumerable.GetEnumerator ()
- {
- return new Pkcs7RecipientEnumerator (_list);
- }
-
- public void Remove (Pkcs7Recipient recipient)
- {
- _list.Remove (recipient);
- }
- }
-}
-
-#endif \ No newline at end of file
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs7RecipientEnumerator.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs7RecipientEnumerator.cs
deleted file mode 100755
index c57096327d7..00000000000
--- a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs7RecipientEnumerator.cs
+++ /dev/null
@@ -1,73 +0,0 @@
-//
-// Pkcs7RecipientEnumerator.cs - System.Security.Cryptography.Pkcs.Pkcs7RecipientEnumerator
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.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.
-//
-
-#if NET_2_0
-
-using System;
-using System.Collections;
-
-namespace System.Security.Cryptography.Pkcs {
-
- public class Pkcs7RecipientEnumerator : IEnumerator {
-
- private IEnumerator enumerator;
-
- // constructors
-
- internal Pkcs7RecipientEnumerator (IEnumerable enumerable)
- {
- enumerator = enumerable.GetEnumerator ();
- }
-
- // properties
-
- public Pkcs7Recipient Current {
- get { return (Pkcs7Recipient) enumerator.Current; }
- }
-
- object IEnumerator.Current {
- get { return enumerator.Current; }
- }
-
- // methods
-
- public bool MoveNext ()
- {
- return enumerator.MoveNext ();
- }
-
- public void Reset ()
- {
- enumerator.Reset ();
- }
- }
-}
-
-#endif \ No newline at end of file
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs7Signer.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs7Signer.cs
deleted file mode 100755
index d41c7b6f5e0..00000000000
--- a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs7Signer.cs
+++ /dev/null
@@ -1,120 +0,0 @@
-//
-// Pkcs7Signer.cs - System.Security.Cryptography.Pkcs.Pkcs7Signer
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.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.
-//
-
-#if NET_2_0
-
-using System;
-using System.Security.Cryptography.X509Certificates;
-
-namespace System.Security.Cryptography.Pkcs {
-
- public sealed class Pkcs7Signer {
-
- private SubjectIdentifierType _signer;
- private X509CertificateEx _certificate;
- private Oid _digest;
- private X509IncludeOption _options;
- private Pkcs9AttributeCollection _auth;
- private Pkcs9AttributeCollection _unauth;
-
- // constructors
-
- public Pkcs7Signer ()
- {
- _signer = SubjectIdentifierType.IssuerAndSerialNumber;
- _digest = new Oid ("1.3.14.3.2.26");
- _options = X509IncludeOption.ExcludeRoot;
- _auth = new Pkcs9AttributeCollection ();
- _unauth = new Pkcs9AttributeCollection ();
- }
-
- public Pkcs7Signer (SubjectIdentifierType signerIdentifierType) : this ()
- {
- if (signerIdentifierType == SubjectIdentifierType.Unknown)
- _signer = SubjectIdentifierType.IssuerAndSerialNumber;
- else
- _signer = signerIdentifierType;
- }
-
- public Pkcs7Signer (SubjectIdentifierType signerIdentifierType, X509CertificateEx certificate)
- : this (signerIdentifierType)
- {
-// FIXME: compatibility with fx 1.2.3400.0
-// if (certificate == null)
-// throw new ArgumentNullException ("certificate");
- _certificate = certificate;
- }
-
- public Pkcs7Signer (X509CertificateEx certificate) : this ()
- {
-// FIXME: compatibility with fx 1.2.3400.0
-// if (certificate == null)
-// throw new ArgumentNullException ("certificate");
- _certificate = certificate;
- }
-
- // properties
-
- public Pkcs9AttributeCollection AuthenticatedAttributes {
- get { return _auth; }
- }
-
- public X509CertificateEx Certificate {
- get { return _certificate; }
- set { _certificate = value; }
- }
-
- public Oid DigestAlgorithm {
- get { return _digest; }
- set { _digest = value; }
- }
-
- public X509IncludeOption IncludeOption {
- get { return _options; }
- set { _options = value; }
- }
-
- public SubjectIdentifierType SignerIdentifierType {
- get { return _signer; }
- set {
- if (value == SubjectIdentifierType.Unknown)
- throw new ArgumentException ("value");
-
- _signer = value;
- }
- }
-
- public Pkcs9AttributeCollection UnauthenticatedAttributes {
- get { return _unauth; }
- }
- }
-}
-
-#endif \ No newline at end of file
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9AttributeCollection.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9AttributeCollection.cs
deleted file mode 100755
index 3c641ab7eb8..00000000000
--- a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9AttributeCollection.cs
+++ /dev/null
@@ -1,99 +0,0 @@
-//
-// Pkcs9AttributeCollection.cs - System.Security.Cryptography.Pkcs.Pkcs9AttributeCollection
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.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.
-//
-
-#if NET_2_0
-
-using System;
-using System.Collections;
-
-namespace System.Security.Cryptography.Pkcs {
-
- public class Pkcs9AttributeCollection : ICollection {
-
- private ArrayList _list;
-
- public Pkcs9AttributeCollection ()
- {
- _list = new ArrayList ();
- }
-
- // properties
-
- public int Count {
- get { return _list.Count; }
- }
-
- public bool IsSynchronized {
- get { return _list.IsSynchronized; }
- }
-
- public Pkcs9Attribute this [int index] {
- get { return (Pkcs9Attribute) _list [index]; }
- }
-
- public object SyncRoot {
- get { return _list.SyncRoot; }
- }
-
- // methods
-
- public int Add (Pkcs9Attribute attribute)
- {
- return _list.Add (attribute);
- }
-
- public void CopyTo (Array array, int index)
- {
- _list.CopyTo (array, index);
- }
-
- public void CopyTo (Pkcs9Attribute[] array, int index)
- {
- _list.CopyTo (array, index);
- }
-
- public Pkcs9AttributeEnumerator GetEnumerator ()
- {
- return new Pkcs9AttributeEnumerator (_list);
- }
-
- IEnumerator IEnumerable.GetEnumerator ()
- {
- return new Pkcs9AttributeEnumerator (_list);
- }
-
- public void Remove (Pkcs9Attribute attribute)
- {
- _list.Remove (attribute);
- }
- }
-}
-
-#endif \ No newline at end of file
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9AttributeEnumerator.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9AttributeEnumerator.cs
deleted file mode 100755
index 51ee474fc70..00000000000
--- a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9AttributeEnumerator.cs
+++ /dev/null
@@ -1,73 +0,0 @@
-//
-// Pkcs9AttributeEnumerator.cs - System.Security.Cryptography.Pkcs.Pkcs9AttributeEnumerator
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.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.
-//
-
-#if NET_2_0
-
-using System;
-using System.Collections;
-
-namespace System.Security.Cryptography.Pkcs {
-
- public class Pkcs9AttributeEnumerator : IEnumerator {
-
- private IEnumerator enumerator;
-
- // constructors
-
- internal Pkcs9AttributeEnumerator (IEnumerable enumerable)
- {
- enumerator = enumerable.GetEnumerator ();
- }
-
- // properties
-
- public Pkcs9Attribute Current {
- get { return (Pkcs9Attribute) enumerator.Current; }
- }
-
- object IEnumerator.Current {
- get { return enumerator.Current; }
- }
-
- // methods
-
- public bool MoveNext ()
- {
- return enumerator.MoveNext ();
- }
-
- public void Reset ()
- {
- enumerator.Reset ();
- }
- }
-}
-
-#endif \ No newline at end of file
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/RecipientInfoType.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/RecipientInfoType.cs
index aefff964b1b..d73e44f029b 100755
--- a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/RecipientInfoType.cs
+++ b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/RecipientInfoType.cs
@@ -2,11 +2,10 @@
// RecipientInfoType.cs - System.Security.Cryptography.Pkcs.RecipientInfoType
//
// Author:
-// Sebastien Pouliot (spouliot@motus.com)
+// Sebastien Pouliot <sebastien@ximian.com>
//
// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-
+// 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
@@ -41,4 +40,4 @@ namespace System.Security.Cryptography.Pkcs {
}
}
-#endif \ No newline at end of file
+#endif
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/RecipientSubType.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/RecipientSubType.cs
deleted file mode 100755
index bb50474ed0e..00000000000
--- a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/RecipientSubType.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-//
-// RecipientSubType.cs - System.Security.Cryptography.Pkcs.RecipientSubType
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.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.
-//
-
-#if NET_2_0
-
-using System;
-
-namespace System.Security.Cryptography.Pkcs {
-
- public enum RecipientSubType {
- Unknown,
- Pkcs7KeyTransport,
- CmsKeyTransport,
- CertIdKeyAgreement,
- PublicKeyAgreement
- }
-}
-
-#endif \ No newline at end of file
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/SignedPkcs7.cs b/mcs/class/System.Security/System.Security.Cryptography.Pkcs/SignedPkcs7.cs
deleted file mode 100755
index 730560c64e1..00000000000
--- a/mcs/class/System.Security/System.Security.Cryptography.Pkcs/SignedPkcs7.cs
+++ /dev/null
@@ -1,275 +0,0 @@
-//
-// SignedPkcs7.cs - System.Security.Cryptography.Pkcs.SignedPkcs7
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.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.
-//
-
-#if NET_2_0
-
-using System;
-using System.Security.Cryptography.X509Certificates;
-using System.Security.Cryptography.Xml;
-using System.Text;
-
-using Mono.Security;
-using Mono.Security.X509;
-
-namespace System.Security.Cryptography.Pkcs {
-
- public sealed class SignedPkcs7 {
-
- private ContentInfo _content;
- private bool _detached;
- private SignerInfoCollection _info;
- private X509CertificateExCollection _certs;
- private SubjectIdentifierType _type;
- private int _version;
-
- // constructors
-
- public SignedPkcs7 ()
- {
- _certs = new X509CertificateExCollection ();
- _info = new SignerInfoCollection ();
- }
-
- public SignedPkcs7 (ContentInfo content) : this (content, false) {}
-
- public SignedPkcs7 (ContentInfo content, bool detached) : this ()
- {
- if (content == null)
- throw new ArgumentNullException ("content");
-
- _content = content;
- _detached = detached;
- }
-
- public SignedPkcs7 (SubjectIdentifierType signerIdentifierType) : this ()
- {
- _type = signerIdentifierType;
- _version = ((_type == SubjectIdentifierType.SubjectKeyIdentifier) ? 2 : 0);
- }
-
- public SignedPkcs7 (SubjectIdentifierType signerIdentifierType, ContentInfo content) : this (content, false)
- {
- _type = signerIdentifierType;
- _version = ((_type == SubjectIdentifierType.SubjectKeyIdentifier) ? 2 : 0);
- }
-
- public SignedPkcs7 (SubjectIdentifierType signerIdentifierType, ContentInfo content, bool detached) : this (content, detached)
- {
- _type = signerIdentifierType;
- _version = ((_type == SubjectIdentifierType.SubjectKeyIdentifier) ? 2 : 0);
- }
-
- // properties
-
- public X509CertificateExCollection Certificates {
- get { return _certs; }
- }
-
- public ContentInfo ContentInfo {
- get {
- if (_content == null) {
- Oid oid = new Oid (PKCS7.Oid.data);
- _content = new ContentInfo (oid, new byte [0]);
- }
- return _content;
- }
- }
-
- public bool Detached {
- get { return _detached; }
- }
-
- public SignerInfoCollection SignerInfos {
- get { return _info; }
- }
-
- public int Version {
- get { return _version; }
- }
-
- // methods
-
- public void CheckSignature (bool verifySignatureOnly)
- {
- foreach (SignerInfo si in _info) {
- si.CheckSignature (verifySignatureOnly);
- }
- }
-
- public void CheckSignature (X509CertificateExCollection extraStore, bool verifySignatureOnly)
- {
- foreach (SignerInfo si in _info) {
- si.CheckSignature (extraStore, verifySignatureOnly);
- }
- }
-
- [MonoTODO]
- public void ComputeSignature ()
- {
- throw new CryptographicException ("");
- }
-
- [MonoTODO]
- public void ComputeSignature (Pkcs7Signer signer)
- {
- ComputeSignature ();
- }
-
- private string ToString (byte[] array)
- {
- StringBuilder sb = new StringBuilder ();
- foreach (byte b in array)
- sb.Append (b.ToString ("X2"));
- return sb.ToString ();
- }
-
- private byte[] GetKeyIdentifier (Mono.Security.X509.X509Certificate x509)
- {
- // if present in certificate return value of the SubjectKeyIdentifier
- Mono.Security.X509.X509Extension extn = x509.Extensions ["2.5.29.14"];
- if (extn != null) {
- ASN1 bs = new ASN1 (extn.Value.Value);
- return bs.Value;
- }
- // strangely DEPRECATED keyAttributes isn't used here (like KeyUsage)
-
- // if not then we must calculate the SubjectKeyIdentifier ourselve
- // Note: MS does that hash on the complete subjectPublicKeyInfo (unlike PKIX)
- // http://groups.google.ca/groups?selm=e7RqM%24plCHA.1488%40tkmsftngp02&oe=UTF-8&output=gplain
- ASN1 subjectPublicKeyInfo = new ASN1 (0x30);
- ASN1 algo = subjectPublicKeyInfo.Add (new ASN1 (0x30));
- algo.Add (new ASN1 (CryptoConfig.EncodeOID (x509.KeyAlgorithm)));
- // FIXME: does it work for DSA certs (without an 2.5.29.14 extension ?)
- algo.Add (new ASN1 (x509.KeyAlgorithmParameters));
- byte[] pubkey = x509.PublicKey;
- byte[] bsvalue = new byte [pubkey.Length + 1]; // add unused bits (0) before the public key
- Array.Copy (pubkey, 0, bsvalue, 1, pubkey.Length);
- subjectPublicKeyInfo.Add (new ASN1 (0x03, bsvalue));
- SHA1 sha = SHA1.Create ();
- return sha.ComputeHash (subjectPublicKeyInfo.GetBytes ());
- }
-
- [MonoTODO("incomplete - missing attributes")]
- public void Decode (byte[] encodedMessage)
- {
- PKCS7.ContentInfo ci = new PKCS7.ContentInfo (encodedMessage);
- if (ci.ContentType != PKCS7.Oid.signedData)
- throw new Exception ("");
-
- PKCS7.SignedData sd = new PKCS7.SignedData (ci.Content);
- SubjectIdentifierType type = SubjectIdentifierType.Unknown;
- object o = null;
-
- X509CertificateEx x509 = null;
- if (sd.SignerInfo.Certificate != null) {
- x509 = new X509CertificateEx (sd.SignerInfo.Certificate.RawData);
- }
- else if ((sd.SignerInfo.IssuerName != null) && (sd.SignerInfo.SerialNumber != null)) {
- byte[] serial = sd.SignerInfo.SerialNumber;
- Array.Reverse (serial); // ???
- type = SubjectIdentifierType.IssuerAndSerialNumber;
- X509IssuerSerial xis = new X509IssuerSerial ();
- xis.IssuerName = sd.SignerInfo.IssuerName;
- xis.SerialNumber = ToString (serial);
- o = xis;
- // TODO: move to a FindCertificate (issuer, serial, collection)
- foreach (Mono.Security.X509.X509Certificate x in sd.Certificates) {
- if (x.IssuerName == sd.SignerInfo.IssuerName) {
- if (ToString (x.SerialNumber) == xis.SerialNumber) {
- x509 = new X509CertificateEx (x.RawData);
- break;
- }
- }
- }
- }
- else if (sd.SignerInfo.SubjectKeyIdentifier != null) {
- string ski = ToString (sd.SignerInfo.SubjectKeyIdentifier);
- type = SubjectIdentifierType.SubjectKeyIdentifier;
- o = (object) ski;
- // TODO: move to a FindCertificate (ski, collection)
- foreach (Mono.Security.X509.X509Certificate x in sd.Certificates) {
- if (ToString (GetKeyIdentifier (x)) == ski) {
- x509 = new X509CertificateEx (x.RawData);
- break;
- }
- }
- }
-
- SignerInfo si = new SignerInfo (sd.SignerInfo.HashName, x509, type, o, sd.SignerInfo.Version);
- // si.AuthenticatedAttributes
- // si.UnauthenticatedAttributes
- _info.Add (si);
-
- ASN1 content = sd.ContentInfo.Content;
- Oid oid = new Oid (sd.ContentInfo.ContentType);
- _content = new ContentInfo (oid, content[0].Value);
-
- foreach (Mono.Security.X509.X509Certificate x in sd.Certificates) {
- _certs.Add (new X509CertificateEx (x.RawData));
- }
-
- _version = sd.Version;
- }
-
- [MonoTODO]
- public byte[] Encode ()
- {
- Mono.Security.X509.X509Certificate x509 = null;
-/* PKCS7.SignerInfo si = new PKCS7.SignerInfo ();
- switch (_type) {
- case SubjectIdentifierType.SubjectKeyIdentifier:
- si.SubjectKeyIdentifier = GetKeyIdentifier (x509);
- break;
- default:
- // SubjectIdentifierType.IssuerAndSerialNumber
- si.IssuerName = x509.IssuerName;
- si.SerialNumber = x509.SerialNumber;
- break;
- }
-
- PKCS7.SignedData sd = new PKCS7.SignedData ();
- sd.Version = _version;
- sd.SignerInfo = si;
-
- PKCS7.ContentInfo ci = new PKCS7.ContentInfo (PKCS7.signedData);
- ci.Content = sd.ASN1;
- return ci.GetBytes ();*/
- return null;
- }
-
- // counterSsignerInfo -> counterSignerInfo
- [MonoTODO]
- public void RemoveSignature (SignerInfo counterSsignerInfo)
- {
- }
- }
-}
-
-#endif