Re: problem with StrongNameIdentityPermissionAttribute
From: Davide Bedin (davide@bedin.it)
Date: 04/17/03
- Next message: Mark: "Customized Encryption component fails in .Net"
- Previous message: Yuri: "Decryption does not work"
- In reply to: Ivan Medvedev [MS]: "Re: problem with StrongNameIdentityPermissionAttribute"
- Next in thread: Ivan Medvedev [MS]: "Re: problem with StrongNameIdentityPermissionAttribute"
- Reply: Ivan Medvedev [MS]: "Re: problem with StrongNameIdentityPermissionAttribute"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
From: "Davide Bedin" <davide@bedin.it> Date: Thu, 17 Apr 2003 14:34:05 +0200
Thanks for the response. I read the documentation about security but still
experiencing troubles, that's why I'm asking this in the newsgroups.
Something I haven't said describing the issue is that I already tried to use
LinkDemand without success, that is what lead me to consider Demand. Using
LinkDemand action for the attribute at method level it doesn't seem it is
considered. I suppose this because it doesn't matter If I use the public key
blob of Microsoft.Web.Services.dll or from one of my assemblies, the code
runs in both cases and the decryption occurs.
If I use the attribute at class level It is checked but I always get an
exception when valuating the permission attribute, using the wrong public
key blob (the one from my assemblies) or the right one (from Microsoft WSE
assembly). I checked the public key blob several times so it seems it's
correct.
Here's the exception I get:
System.Security.SecurityException: Request for the permission of type
System.Security.Permissions.StrongNameIdentityPermission, mscorlib,
Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
at System.Security.CodeAccessSecurityEngine.CheckTokenBasedSetHelper(Boolean
ignoreGrants, TokenBasedSet grants, TokenBasedSet denied, TokenBasedSet
demands) at
System.Security.CodeAccessSecurityEngine.CheckSetHelper(PermissionSet
grants, PermissionSet denied, PermissionSet demands) at
System.Reflection.RuntimeConstructorInfo.InternalInvoke(BindingFlags
invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean
isBinderDefault) at
System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr,
Binder binder, Object[] parameters, CultureInfo culture) at
Microsoft.Web.Services.Security.Configuration.ProviderFactory.CreateInstance
() at
Microsoft.Web.Services.Security.Configuration.SecurityConfiguration.get_Pass
wordProvider() at
Microsoft.Web.Services.Security.UsernameToken.GetPassword() at
Microsoft.Web.Services.Security.UsernameToken.LoadXml(XmlElement element) at
Microsoft.Web.Services.Security.SecurityToken..ctor(XmlElement element) at
Microsoft.Web.Services.Security.UsernameToken..ctor(XmlElement element) at
Microsoft.Web.Services.Security.Security.LoadXml(XmlElement element) at
Microsoft.Web.Services.Security.SecurityInputFilter.ProcessMessage(SoapEnvel
ope envelope) at
Microsoft.Web.Services.Pipeline.ProcessInputMessage(SoapEnvelope envelope)
at
Microsoft.Web.Services.WebServicesExtension.BeforeDeserializeServer(SoapMess
age message) The state of the failed permission was: <IPermission
class="System.Security.Permissions.StrongNameIdentityPermission, mscorlib,
Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
PublicKeyBlob="0024000004800000940000000602000000240000525341310004000001000
100B5FC90E7027F67871E773A8FDE8938C81DD402BA65B9201D60593E96C492651E889CC13F1
415EBB53FAC1131AE0BD333C5EE6021672D9718EA31A8AEBD0DA0072F25D87DBA6FC90FFD598
ED4DA35E44C398C454307E8E33B8426143DAEC9F596836F97C8F74750E5975C64E2189F45DEF
46B2A2B1247ADC3652BF5C308055DA9
Note that the class/method I want to protect is dynamically loaded as this
is the way WSE works.
Thanks in advance,
Davide Bedin
"Ivan Medvedev [MS]" <ivanmed@online.microsoft.com> wrote in message
news:edPcqiqADHA.3208@TK2MSFTNGP11.phx.gbl...
> Davide -
> it sounds like SecurityAction.LinkDemand is what you need. It will verify
> that just the immediate caller of the method has the identity. Demand does
a
> full stack walk and verifies all the frames on the stack, and Assert does
> not perform any checks at all, it is used to modify stack walk behavior.
> http://msdn.microsoft.com/net/security might be a good resource for you to
> start learning about .net security.
> --Ivan
>
> This posting is provided "AS IS" with no warranties, and confers no
rights.
>
>
>
> "Davide Bedin" <davide@bedin.it> wrote in message
> news:e4DXkhpADHA.33376@TK2MSFTNGP10.phx.gbl...
> > I'm using the Web Service Extensions provided by the
> Microsoft.Web.Services
> > assembly in order to digitally sign and encrypt incoming and outgoing
soap
> > messages.
> >
> > As suggested on the WSE documentation I'm trying to protect the access
to
> > the class that implements the IDecryptionProvider in order to just let
the
> > Microsoft.Web.Services assembly to call the methods.
> >
> > I'm using the StrongNameIdentityPermissionAttribute attribute in the
> > GetDecryptionKey method, using the public key of the
> > Microsoft.Web.Services.dll assembly, as follows
> >
> > <StrongNameIdentityPermissionAttribute(SecurityAction.Assert, _
> > PublicKey:="key of Microsoft.Web.Services.dll")>_
> > Public Function GetDecryptionKey(ByVal algorithmUri As String, ByVal
> keyInfo
> > As KeyInfo) As Microsoft.Web.Services.Security.DecryptionKey Implements
> > Microsoft.Web.Services.Security.IDecryptionKeyProvider.GetDecryptionKey
> >
> > Is Assert the action that has to be requested for this kind of control?
> > If I use Demand the assemblies higher in the stack get a permission
> > exception as they have different strong names than
Microsoft.Web.Services.
> >
> > The problem is that If I use Assert and I change the PublicKey with the
> > strong name of another
> > assembly (for example the public key of assemblies from my company) it
> > doesn't encounter an exception.
> >
> > I'm probably missing something here, any advice will be really
> appreciated.
> >
> > Thanks,
> > Davide Bedin
> >
> >
> >
>
>
- Next message: Mark: "Customized Encryption component fails in .Net"
- Previous message: Yuri: "Decryption does not work"
- In reply to: Ivan Medvedev [MS]: "Re: problem with StrongNameIdentityPermissionAttribute"
- Next in thread: Ivan Medvedev [MS]: "Re: problem with StrongNameIdentityPermissionAttribute"
- Reply: Ivan Medvedev [MS]: "Re: problem with StrongNameIdentityPermissionAttribute"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|