X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2Fcorlib%2FSystem.Reflection%2FStrongNameKeyPair.cs;h=aff2ae187e6e69546a111e67f70b70a279f0ced9;hb=ac194553049b2eeb328f5fc54b708da9b95f4d88;hp=eff73aecbb421a7efdec36154c8d8a9578fc032a;hpb=b6b13e72e91d5b529a6306ce53bda685932c77db;p=mono.git diff --git a/mcs/class/corlib/System.Reflection/StrongNameKeyPair.cs b/mcs/class/corlib/System.Reflection/StrongNameKeyPair.cs index eff73aecbb4..aff2ae187e6 100644 --- a/mcs/class/corlib/System.Reflection/StrongNameKeyPair.cs +++ b/mcs/class/corlib/System.Reflection/StrongNameKeyPair.cs @@ -33,17 +33,16 @@ using System.IO; using System.Security.Cryptography; using System.Security.Permissions; using System.Runtime.InteropServices; +using System.Runtime.Serialization; using Mono.Security; using Mono.Security.Cryptography; namespace System.Reflection { -#if NET_2_0 [ComVisible (true)] -#endif [Serializable] -public class StrongNameKeyPair +public class StrongNameKeyPair : ISerializable, IDeserializationCallback { private byte[] _publicKey; private string _keyPairContainer; @@ -88,7 +87,26 @@ public class StrongNameKeyPair _keyPairContainer = keyPairContainer; GetRSA (); } - + protected StrongNameKeyPair (SerializationInfo info, StreamingContext context) + { + _publicKey = (byte []) info.GetValue ("_publicKey", typeof (byte [])); + _keyPairContainer = info.GetString ("_keyPairContainer"); + _keyPairExported = info.GetBoolean ("_keyPairExported"); + _keyPairArray = (byte []) info.GetValue ("_keyPairArray", typeof (byte [])); + } + + void ISerializable.GetObjectData (SerializationInfo info, StreamingContext context) + { + info.AddValue ("_publicKey", _publicKey, typeof (byte [])); + info.AddValue ("_keyPairContainer", _keyPairContainer); + info.AddValue ("_keyPairExported", _keyPairExported); + info.AddValue ("_keyPairArray", _keyPairArray, typeof (byte [])); + } + + void IDeserializationCallback.OnDeserialization (object sender) + { + } + private RSA GetRSA () { if (_rsa != null) return _rsa; @@ -103,11 +121,13 @@ public class StrongNameKeyPair _keyPairArray = null; } } +#if !NET_2_1 else if (_keyPairContainer != null) { CspParameters csp = new CspParameters (); csp.KeyContainerName = _keyPairContainer; _rsa = new RSACryptoServiceProvider (csp); } +#endif return _rsa; }