Author: atsushi
Date: 2007-04-04 06:11:15 -0400 (Wed, 04 Apr 2007)
New Revision: 75378

Added:
   
trunk/olive/class/System.IdentityModel.Selectors/System.IdentityModel.Selectors/NativeGenericXmlToken.cs
   
trunk/olive/class/System.IdentityModel.Selectors/System.IdentityModel.Selectors/NativeInfocardCryptoHandle.cs
   
trunk/olive/class/System.IdentityModel.Selectors/System.IdentityModel.Selectors/NativeInfocardHandleType.cs
   
trunk/olive/class/System.IdentityModel.Selectors/System.IdentityModel.Selectors/NativePolicyElement.cs
Modified:
   
trunk/olive/class/System.IdentityModel.Selectors/System.IdentityModel.Selectors.dll.sources
   
trunk/olive/class/System.IdentityModel.Selectors/System.IdentityModel.Selectors/CardSpacePolicyElement.cs
   
trunk/olive/class/System.IdentityModel.Selectors/System.IdentityModel.Selectors/CardSpaceSelector.cs
   
trunk/olive/class/System.IdentityModel.Selectors/System.IdentityModel.Selectors/ChangeLog
Log:
2007-04-04  Atsushi Enomoto  <[EMAIL PROTECTED]>

        * CardSpacePolicyElement.cs : implemented.
        * CardspaceSelector.cs : win32 implementation.
        * NativePolicyElement.cs,
          NativeGenericXmlToken.cs,
          NativeInfocardCryptoHandle.cs,
          NativeInfocardHandleType.cs : win32 interop structures.



Modified: 
trunk/olive/class/System.IdentityModel.Selectors/System.IdentityModel.Selectors/CardSpacePolicyElement.cs
===================================================================
--- 
trunk/olive/class/System.IdentityModel.Selectors/System.IdentityModel.Selectors/CardSpacePolicyElement.cs
   2007-04-04 09:01:49 UTC (rev 75377)
+++ 
trunk/olive/class/System.IdentityModel.Selectors/System.IdentityModel.Selectors/CardSpacePolicyElement.cs
   2007-04-04 10:11:15 UTC (rev 75378)
@@ -4,7 +4,7 @@
 // Author:
 //     Atsushi Enomoto <[EMAIL PROTECTED]>
 //
-// Copyright (C) 2006 Novell, Inc.  http://www.novell.com
+// Copyright (C) 2006-2007 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
@@ -27,14 +27,12 @@
 //
 using System;
 using System.Collections.ObjectModel;
-using System.Runtime.Serialization;
 using System.Xml;
 
 namespace System.IdentityModel.Selectors
 {
        public class CardSpacePolicyElement
        {
-               [MonoTODO]
                public CardSpacePolicyElement (
                        XmlElement target, XmlElement issuer,
                        Collection<XmlElement> parameters,
@@ -42,43 +40,53 @@
                        int privacyNoticeVersion,
                        bool isManagedIssuer)
                {
-                       throw new NotImplementedException ();
+                       this.target = target;
+                       this.issuer = issuer;
+                       this.parameters = parameters ?? new 
Collection<XmlElement> ();
+                       this.privacy_link = privacyNoticeLink;
+                       privacy_ver = privacyNoticeVersion;
+                       is_managed = isManagedIssuer;
                }
 
-               [MonoTODO]
+               XmlElement target;
+               XmlElement issuer;
+               Collection<XmlElement> parameters;
+               Uri privacy_link;
+               int privacy_ver;
+               bool is_managed;
+
+               internal NativePolicyElement GetNativeObject ()
+               {
+                       return new NativePolicyElement (target, issuer, 
parameters, privacy_link, privacy_ver, is_managed);
+               }
+
                public bool IsManagedIssuer {
-                       get { throw new NotImplementedException (); }
-                       set { throw new NotImplementedException (); }
+                       get { return is_managed; }
+                       set { is_managed = value; }
                }
 
-               [MonoTODO]
                public XmlElement Issuer {
-                       get { throw new NotImplementedException (); }
-                       set { throw new NotImplementedException (); }
+                       get { return issuer; }
+                       set { issuer = value; }
                }
 
-               [MonoTODO]
                public Collection<XmlElement> Parameters {
-                       get { throw new NotImplementedException (); }
+                       get { return parameters; }
                }
 
-
-               [MonoTODO]
                public Uri PolicyNoticeLink {
-                       get { throw new NotImplementedException (); }
-                       set { throw new NotImplementedException (); }
+                       get { return privacy_link; }
+                       set { privacy_link = value; }
                }
 
-               [MonoTODO]
                public int PolicyNoticeVersion {
-                       get { throw new NotImplementedException (); }
-                       set { throw new NotImplementedException (); }
+                       get { return privacy_ver; }
+                       set { privacy_ver = value; }
                }
 
-               [MonoTODO]
                public XmlElement Target {
-                       get { throw new NotImplementedException (); }
-                       set { throw new NotImplementedException (); }
+                       get { return target; }
+                       set { target = value; }
                }
        }
 }

Modified: 
trunk/olive/class/System.IdentityModel.Selectors/System.IdentityModel.Selectors/CardSpaceSelector.cs
===================================================================
--- 
trunk/olive/class/System.IdentityModel.Selectors/System.IdentityModel.Selectors/CardSpaceSelector.cs
        2007-04-04 09:01:49 UTC (rev 75377)
+++ 
trunk/olive/class/System.IdentityModel.Selectors/System.IdentityModel.Selectors/CardSpaceSelector.cs
        2007-04-04 10:11:15 UTC (rev 75378)
@@ -4,7 +4,7 @@
 // Author:
 //     Atsushi Enomoto <[EMAIL PROTECTED]>
 //
-// Copyright (C) 2005-2006 Novell, Inc.  http://www.novell.com
+// Copyright (C) 2005-2007 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
@@ -28,19 +28,39 @@
 using System;
 using System.Collections;
 using System.Collections.Generic;
+using System.Collections.ObjectModel;
 using System.IdentityModel.Tokens;
+using System.Runtime.InteropServices;
 using System.Xml;
 
 namespace System.IdentityModel.Selectors
 {
        public static class CardSpaceSelector
        {
+               static readonly bool use_win32api = 
Environment.OSVersion.Platform != PlatformID.Unix;
+
                [MonoTODO]
                public static GenericXmlSecurityToken GetToken (
                        CardSpacePolicyElement [] policyChain,
                        SecurityTokenSerializer serializer)
                {
-                       throw new NotImplementedException ();
+                       if (use_win32api) {
+                               NativeGenericXmlToken token;
+                               NativeInfocardCryptoHandle proof;
+                               NativePolicyElement [] natives =
+                                       new NativePolicyElement 
[policyChain.Length];
+                               for (int i = 0; i < policyChain.Length; i++)
+                                       natives [i] = policyChain 
[i].GetNativeObject ();
+                               NativeGetTokenResults ret = GetToken 
(policyChain.Length, natives, out token, out proof);
+                               switch (ret) {
+                               case NativeGetTokenResults.OK:
+                                       return token.ToObject (proof, 
serializer);
+                               default:
+                                       throw CardspaceError (ret);
+                               }
+                       }
+                       else
+                               throw new NotImplementedException ();
                }
 
                [MonoTODO]
@@ -50,19 +70,82 @@
                        XmlElement requiredRemoteTokenIssuer,
                        SecurityTokenSerializer serializer)
                {
-                       throw new NotImplementedException ();
+                       CardSpacePolicyElement pe = new CardSpacePolicyElement 
(endpoint, requiredRemoteTokenIssuer, new Collection<XmlElement> (new 
List<XmlElement> (policy)), null, 0, false);
+                       return GetToken (new CardSpacePolicyElement [] {pe}, 
serializer);
                }
 
                [MonoTODO]
                public static void Import (string fileName)
                {
-                       throw new NotImplementedException ();
+                       if (use_win32api)
+                               ImportInformationCard (fileName);
+                       else
+                               throw new NotImplementedException ();
                }
 
                [MonoTODO]
                public static void Manage ()
                {
-                       throw new NotImplementedException ();
+                       if (use_win32api)
+                               ManageCardSpace ();
+                       else
+                               throw new NotImplementedException ();
                }
+
+               static Exception CardspaceError (NativeGetTokenResults error)
+               {
+                       switch (error) {
+                       default:
+                               throw new NotImplementedException 
(String.Format ("not implemented error type: {0:X}", error));
+                       }
+               }
+
+               [DllImport ("infocardapi", CharSet = CharSet.Unicode)]
+               static extern NativeGetTokenResults GetToken (int cPolicyChain,
+                       NativePolicyElement [] pPolicyChain,
+                       out NativeGenericXmlToken securityToken,
+                       out NativeInfocardCryptoHandle phProofTokenCrypto);
+
+               [DllImport ("infocardapi")]
+               static extern void ManageCardSpace ();
+
+               [DllImport ("infocardapi", CharSet = CharSet.Unicode)]
+               static extern void ImportInformationCard (string fileName);
+
+               enum NativeGetTokenResults : long
+               {
+                       OK = 0,
+                       ErrorOnCommunication            = 0xC0050100,
+                       ErrorOnDataAccess               = 0xC0050101,
+                       ErrorOnExport                   = 0xC0050102,
+                       IdentityVerificationFailed      = 0xC0050103,
+                       ErrorOnImport                   = 0xC0050104,
+                       InvalidArgument                 = 0xC0050105,
+                       ErrorInRequest                  = 0xC0050106,
+                       ErrorInCardData                 = 0xC0050107,
+                       InvalidDecryptionKey            = 0xC0050108,
+                       InvalidCertificateLogo          = 0xC0050109,
+                       InvalidPassword                 = 0xC005010A,
+                       InvalidPolicy                   = 0xC005010B,
+                       ProcessDied                     = 0xC005010C,
+                       ServiceBusy                     = 0xC005010D,
+                       ServiceUnavailable              = 0xC005010E,
+                       Shuttingdown                    = 0xC005010F,
+                       ErrorOnTokenCreation            = 0xC0050110,
+                       TrustExchangeFailure            = 0xC0050111,
+                       UntrustedRecipient              = 0xC0050112,
+                       UserCancelled                   = 0xC0050113,
+                       ErrorOnStoreImport              = 0xC0050114,
+                       UIStartFailure                  = 0xC0050115,
+                       UnsupportedPolicy               = 0xC0050116,
+                       MaxSession                      = 0xC0050117,
+                       ImportFileAccessFailure         = 0xC0050118,
+                       MalformedRequest                = 0xC0050119,
+                       RefreshRequired                 = 0xC0050180,
+                       MissingAppliesTo                = 0xC0050181,
+                       InvalidProofKey                 = 0xC0050182,
+                       UnknownReference                = 0xC0050183,
+                       ClaimsNotProvided               = 0xC0050184,
+               }
        }
 }

Modified: 
trunk/olive/class/System.IdentityModel.Selectors/System.IdentityModel.Selectors/ChangeLog
===================================================================
--- 
trunk/olive/class/System.IdentityModel.Selectors/System.IdentityModel.Selectors/ChangeLog
   2007-04-04 09:01:49 UTC (rev 75377)
+++ 
trunk/olive/class/System.IdentityModel.Selectors/System.IdentityModel.Selectors/ChangeLog
   2007-04-04 10:11:15 UTC (rev 75378)
@@ -1,3 +1,12 @@
+2007-04-04  Atsushi Enomoto  <[EMAIL PROTECTED]>
+
+       * CardSpacePolicyElement.cs : implemented.
+       * CardspaceSelector.cs : win32 implementation.
+       * NativePolicyElement.cs,
+         NativeGenericXmlToken.cs,
+         NativeInfocardCryptoHandle.cs,
+         NativeInfocardHandleType.cs : win32 interop structures.
+
 2006-07-18  Atsushi Enomoto  <[EMAIL PROTECTED]>
 
        * ServiceBusyException.cs, IdentityValidationException.cs,

Added: 
trunk/olive/class/System.IdentityModel.Selectors/System.IdentityModel.Selectors/NativeGenericXmlToken.cs
===================================================================
--- 
trunk/olive/class/System.IdentityModel.Selectors/System.IdentityModel.Selectors/NativeGenericXmlToken.cs
    2007-04-04 09:01:49 UTC (rev 75377)
+++ 
trunk/olive/class/System.IdentityModel.Selectors/System.IdentityModel.Selectors/NativeGenericXmlToken.cs
    2007-04-04 10:11:15 UTC (rev 75378)
@@ -0,0 +1,92 @@
+//
+// NativeGenericXmlToken.cs
+//
+// Author:
+//     Atsushi Enomoto <[EMAIL PROTECTED]>
+//
+// Copyright (C) 2007 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.ObjectModel;
+using System.IO;
+using System.IdentityModel.Selectors;
+using System.IdentityModel.Tokens;
+using System.Runtime.InteropServices;
+using System.Xml;
+
+namespace System.IdentityModel.Selectors
+{
+       [StructLayout (LayoutKind.Sequential)]
+       struct NativeGenericXmlToken
+       {
+               // This field order must be fixed for win32 API interop:
+               long created;
+               long expired;
+               string xml_token;
+               string internal_ref;
+               string external_ref;
+
+               public NativeGenericXmlToken (GenericXmlSecurityToken token, 
SecurityTokenSerializer serializer)
+               {
+                       created = token.ValidFrom.ToFileTime ();
+                       expired = token.ValidTo.ToFileTime ();
+                       xml_token = token.TokenXml.OuterXml;
+                       XmlWriterSettings settings = new XmlWriterSettings ();
+                       settings.OmitXmlDeclaration = true;
+                       internal_ref = GetKeyIdentifierClauseXml (serializer, 
settings, token.InternalTokenReference);
+                       external_ref = GetKeyIdentifierClauseXml (serializer, 
settings, token.ExternalTokenReference);
+               }
+
+               public static string GetKeyIdentifierClauseXml 
(SecurityTokenSerializer serializer, XmlWriterSettings settings, 
SecurityKeyIdentifierClause item)
+               {
+                       StringWriter sw = new StringWriter ();
+                       using (XmlWriter xw = XmlWriter.Create (sw)) {
+                               serializer.WriteKeyIdentifierClause (xw, item);
+                       }
+                       return sw.ToString ();
+               }
+
+               public GenericXmlSecurityToken ToObject 
(NativeInfocardCryptoHandle proofTokenHandle, SecurityTokenSerializer 
serializer)
+               {
+                       XmlDocument doc = new XmlDocument ();
+                       doc.LoadXml (xml_token);
+                       XmlElement token = doc.DocumentElement;
+                       string proofTokenXml = proofTokenHandle.ToXmlString ();
+                       SecurityToken proof = serializer.ReadToken (Create 
(proofTokenXml), null);
+
+                       DateTime effective = DateTime.FromFileTime (created);
+                       DateTime expiration = DateTime.FromFileTime (expired);
+
+                       SecurityKeyIdentifierClause intref =
+                               serializer.ReadKeyIdentifierClause (Create 
(internal_ref));
+                       SecurityKeyIdentifierClause extref =
+                               serializer.ReadKeyIdentifierClause (Create 
(external_ref));
+                       return new GenericXmlSecurityToken (token, proof, 
effective, expiration, intref, extref, null);
+               }
+
+               XmlDictionaryReader Create (string xml)
+               {
+                       XmlReader xr = XmlReader.Create (new StringReader 
(external_ref));
+                       return XmlDictionaryReader.CreateDictionaryReader (xr);
+               }
+       }
+}

Added: 
trunk/olive/class/System.IdentityModel.Selectors/System.IdentityModel.Selectors/NativeInfocardCryptoHandle.cs
===================================================================
--- 
trunk/olive/class/System.IdentityModel.Selectors/System.IdentityModel.Selectors/NativeInfocardCryptoHandle.cs
       2007-04-04 09:01:49 UTC (rev 75377)
+++ 
trunk/olive/class/System.IdentityModel.Selectors/System.IdentityModel.Selectors/NativeInfocardCryptoHandle.cs
       2007-04-04 10:11:15 UTC (rev 75378)
@@ -0,0 +1,115 @@
+//
+// NativeInfocardCryptoHandle.cs
+//
+// Author:
+//     Atsushi Enomoto <[EMAIL PROTECTED]>
+//
+// Copyright (C) 2007 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.ObjectModel;
+using System.Runtime.InteropServices;
+using System.Xml;
+
+namespace System.IdentityModel.Selectors
+{
+       // see http://msdn2.microsoft.com/en-us/library/aa702727.aspx
+
+       [StructLayout (LayoutKind.Sequential)]
+       struct NativeInfocardCryptoHandle
+       {
+               // This field order must be fixed for win32 API interop:
+               NativeInfocardHandleType handle_type;
+               long expiration;
+               NativeCryptoParameters parameters;
+
+               public string ToXmlString ()
+               {
+                       // FIXME: implement
+                       throw new NotImplementedException ();
+               }
+       }
+
+       [StructLayout (LayoutKind.Explicit)]
+       struct NativeCryptoParameters
+       {
+               [FieldOffset (0)]
+               NativeAsymmetricCryptoParameters asymmetric;
+               [FieldOffset (0)]
+               NativeSymmetricCryptoParameters symmetric;
+               [FieldOffset (0)]
+               NativeTransformCryptoParameters transform;
+               [FieldOffset (0)]
+               NativeHashCryptoParameters hash;
+
+               public NativeAsymmetricCryptoParameters Asymmetric {
+                       get { return asymmetric; }
+               }
+
+               public NativeSymmetricCryptoParameters Symmetric {
+                       get { return symmetric; }
+               }
+
+               public NativeTransformCryptoParameters Transform {
+                       get { return transform; }
+               }
+
+               public NativeHashCryptoParameters Hash {
+                       get { return hash; }
+               }
+       }
+
+#pragma warning disable 169
+       [StructLayout (LayoutKind.Sequential)]
+       struct NativeAsymmetricCryptoParameters
+       {
+               int key_size;
+               string encalg;
+               string sigalg;
+       }
+
+       [StructLayout (LayoutKind.Sequential)]
+       struct NativeSymmetricCryptoParameters
+       {
+               int key_size;
+               int block_size;
+               int feedback_size;
+       }
+
+       [StructLayout (LayoutKind.Sequential)]
+       struct NativeTransformCryptoParameters
+       {
+               int input_block_size;
+               int output_block_size;
+               bool multi_block_supported;
+               bool reusable;
+       }
+
+       [StructLayout (LayoutKind.Sequential)]
+       struct NativeHashCryptoParameters
+       {
+               int hash_size;
+               NativeTransformCryptoParameters transform;
+       }
+
+#pragma warning restore 169
+}

Added: 
trunk/olive/class/System.IdentityModel.Selectors/System.IdentityModel.Selectors/NativeInfocardHandleType.cs
===================================================================
--- 
trunk/olive/class/System.IdentityModel.Selectors/System.IdentityModel.Selectors/NativeInfocardHandleType.cs
 2007-04-04 09:01:49 UTC (rev 75377)
+++ 
trunk/olive/class/System.IdentityModel.Selectors/System.IdentityModel.Selectors/NativeInfocardHandleType.cs
 2007-04-04 10:11:15 UTC (rev 75378)
@@ -0,0 +1,38 @@
+//
+// NativeInfocardHandleType.cs
+//
+// Author:
+//     Atsushi Enomoto <[EMAIL PROTECTED]>
+//
+// Copyright (C) 2007 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.
+//
+
+namespace System.IdentityModel.Selectors
+{
+       enum NativeInfocardHandleType
+       {
+               Asymmetric = 1,
+               Symmetric,
+               Transform,
+               Hash
+       }
+}

Added: 
trunk/olive/class/System.IdentityModel.Selectors/System.IdentityModel.Selectors/NativePolicyElement.cs
===================================================================
--- 
trunk/olive/class/System.IdentityModel.Selectors/System.IdentityModel.Selectors/NativePolicyElement.cs
      2007-04-04 09:01:49 UTC (rev 75377)
+++ 
trunk/olive/class/System.IdentityModel.Selectors/System.IdentityModel.Selectors/NativePolicyElement.cs
      2007-04-04 10:11:15 UTC (rev 75378)
@@ -0,0 +1,68 @@
+//
+// NativePolicyElement.cs
+//
+// Author:
+//     Atsushi Enomoto <[EMAIL PROTECTED]>
+//
+// Copyright (C) 2007 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.ObjectModel;
+using System.Runtime.InteropServices;
+using System.Xml;
+
+namespace System.IdentityModel.Selectors
+{
+       [StructLayout (LayoutKind.Sequential)]
+       class NativePolicyElement
+       {
+               // This field order must be fixed for win32 API interop:
+               string target;
+               string issuer;
+               string parameters;
+               string privacy_link;
+               int privacy_ver;
+               bool is_managed;
+
+               public NativePolicyElement (
+                       XmlElement target, XmlElement issuer,
+                       Collection<XmlElement> parameters,
+                       Uri privacyNoticeLink,
+                       int privacyNoticeVersion,
+                       bool isManagedIssuer)
+               {
+                       if (target == null)
+                               throw new ArgumentException ("target");
+                       if (issuer == null)
+                               throw new ArgumentException ("issuer");
+                       if (parameters == null)
+                               throw new ArgumentException ("parameters");
+                       this.target = target.OuterXml;
+                       this.issuer = issuer.OuterXml;
+                       foreach (XmlElement el in parameters)
+                               this.parameters += el.OuterXml;
+                       this.privacy_link = privacyNoticeLink != null ? 
privacyNoticeLink.ToString () : String.Empty;
+                       privacy_ver = privacyNoticeVersion;
+                       is_managed = isManagedIssuer;
+               }
+       }
+}

Modified: 
trunk/olive/class/System.IdentityModel.Selectors/System.IdentityModel.Selectors.dll.sources
===================================================================
--- 
trunk/olive/class/System.IdentityModel.Selectors/System.IdentityModel.Selectors.dll.sources
 2007-04-04 09:01:49 UTC (rev 75377)
+++ 
trunk/olive/class/System.IdentityModel.Selectors/System.IdentityModel.Selectors.dll.sources
 2007-04-04 10:11:15 UTC (rev 75378)
@@ -1,10 +1,15 @@
 ../../build/common/Consts.cs
+../../build/common/Locale.cs
 ../../build/common/MonoTODOAttribute.cs
 Assembly/AssemblyInfo.cs
 System.IdentityModel.Selectors/CardSpaceException.cs
 System.IdentityModel.Selectors/CardSpacePolicyElement.cs
 System.IdentityModel.Selectors/CardSpaceSelector.cs
 System.IdentityModel.Selectors/IdentityValidationException.cs
+System.IdentityModel.Selectors/NativeGenericXmlToken.cs
+System.IdentityModel.Selectors/NativeInfocardCryptoHandle.cs
+System.IdentityModel.Selectors/NativeInfocardHandleType.cs
+System.IdentityModel.Selectors/NativePolicyElement.cs
 System.IdentityModel.Selectors/PolicyValidationException.cs
 System.IdentityModel.Selectors/ServiceBusyException.cs
 System.IdentityModel.Selectors/ServiceNotStartedException.cs

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to