CryptoConfig.cs: Inverse name and oid when reading them from machine.config. Part...
[mono.git] / mcs / class / corlib / System.Security.Cryptography / MACTripleDES.cs
index dcf121182ef715d1e185295536ee50d8ae3e8148..73eb0e58fbaa3df3a5026494a34867033fdef5aa 100644 (file)
@@ -2,13 +2,10 @@
 // MACTripleDES.cs: Handles MAC with TripleDES
 //
 // Author:
-//     Sebastien Pouliot (spouliot@motus.com)
+//     Sebastien Pouliot (sebastien@ximian.com)
 //
 // (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.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
@@ -30,7 +27,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
+using System.Runtime.InteropServices;
 
 using Mono.Security.Cryptography;
 
@@ -42,6 +39,9 @@ namespace System.Security.Cryptography {
        //      http://www.itl.nist.gov/fipspubs/fip81.htm
        
        // LAMESPEC: MACTripleDES == MAC-CBC using TripleDES (not MAC-CFB).
+#if NET_2_0
+       [ComVisible (true)]
+#endif
        public class MACTripleDES: KeyedHashAlgorithm {
        
                private TripleDES tdes;
@@ -73,6 +73,8 @@ namespace System.Security.Cryptography {
                private void Setup (string strTripleDES, byte[] rgbKey) 
                {
                        tdes = TripleDES.Create (strTripleDES);
+                       // default padding (as using in Fx 1.0 and 1.1)
+                       tdes.Padding = PaddingMode.Zeros;
                        // if rgbKey is null we keep the randomly generated key
                        if (rgbKey != null) {
                                // this way we get the TripleDES key validation (like weak
@@ -91,7 +93,15 @@ namespace System.Security.Cryptography {
                {
                        Dispose (false);
                }
-       
+
+#if NET_2_0
+               [ComVisible (false)]
+               public PaddingMode Padding {
+                       get { return tdes.Padding; }
+                       set { tdes.Padding = value; }
+               }
+#endif
+
                protected override void Dispose (bool disposing) 
                {
                        if (!m_disposed) {
@@ -142,4 +152,4 @@ namespace System.Security.Cryptography {
                        return mac.Final ();
                }
        }
-}
\ No newline at end of file
+}