2007-08-17 Sebastien Pouliot <sebastien@ximian.com>
[mono.git] / mcs / class / corlib / System.Security.Cryptography / AsymmetricAlgorithm.cs
old mode 100755 (executable)
new mode 100644 (file)
index 94115c1..9447908
@@ -3,59 +3,69 @@
 //
 // Authors:
 //     Thomas Neidhart (tome@sbox.tugraz.at)
-//     Sebastien Pouliot (spouliot@motus.com)
+//     Sebastien Pouliot (sebastien@ximian.com)
 //
 // Portions (C) 2002, 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
+// 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.Globalization;
+using System.Runtime.InteropServices;
 
 namespace System.Security.Cryptography {
 
-       /// <summary>
-       /// Abstract base class for all cryptographic asymmetric algorithms.
-       /// Available algorithms include:
-       /// RSA, DSA
-       /// </summary>
+#if NET_2_0
+       [ComVisible (true)]
+#endif
        public abstract class AsymmetricAlgorithm : IDisposable {
 
-               protected int KeySizeValue; // The size of the secret key used by the symmetric algorithm in bits. 
-               protected KeySizes[] LegalKeySizesValue; // Specifies the key sizes that are supported by the symmetric algorithm. 
+               protected int KeySizeValue;
+               protected KeySizes[] LegalKeySizesValue; 
 
-               /// <summary>
-               /// Called from constructor of derived class.
-               /// </summary>
-               protected AsymmetricAlgorithm () {}
+               protected AsymmetricAlgorithm ()
+               {
+               }
                
-               /// <summary>
-               /// Gets the key exchange algorithm
-               /// </summary>
-               public abstract string KeyExchangeAlgorithm {get;}
+               public abstract string KeyExchangeAlgorithm {
+                       get;
+               }
                
-               /// <summary>
-               /// Gets or sets the actual key size
-               /// </summary>
                public virtual int KeySize {
                        get { return this.KeySizeValue; }
                        set {
                                if (!KeySizes.IsLegalKeySize (this.LegalKeySizesValue, value))
-                                       throw new CryptographicException("key size not supported by algorithm");
+                                       throw new CryptographicException (Locale.GetText ("Key size not supported by algorithm."));
                                
                                this.KeySizeValue = value;
                        }
                }
 
-               /// <summary>
-               /// Gets all legal key sizes
-               /// </summary>
                public virtual KeySizes[] LegalKeySizes {
                        get { return this.LegalKeySizesValue; }
                }
 
-               /// <summary>
-               /// Gets the signature algorithm
-               /// </summary>
-               public abstract string SignatureAlgorithm {get;}
+               public abstract string SignatureAlgorithm {
+                       get;
+               }
 
                void IDisposable.Dispose () 
                {
@@ -70,32 +80,18 @@ namespace System.Security.Cryptography {
 
                protected abstract void Dispose (bool disposing);
 
-               /// <summary>
-               /// Reconstructs the AsymmetricAlgorithm Object from an XML-string
-               /// </summary>
                public abstract void FromXmlString (string xmlString);
                
-               /// <summary>
-               /// Returns an XML string representation the current AsymmetricAlgorithm object
-               /// </summary>
                public abstract string ToXmlString (bool includePrivateParameters);             
                
-               /// <summary>
-               /// Creates the default implementation of the default asymmetric algorithm (RSA).
-               /// </summary>
                public static AsymmetricAlgorithm Create () 
                {
                        return Create ("System.Security.Cryptography.AsymmetricAlgorithm");
                }
        
-               /// <summary>
-               /// Creates a specific implementation of the given asymmetric algorithm.
-               /// </summary>
-               /// <param name="algo">Specifies which derived class to create</param>
                public static AsymmetricAlgorithm Create (string algName) 
                {
                        return (AsymmetricAlgorithm) CryptoConfig.CreateFromName (algName);
                }
        }
 }
-