Code Access Security

Discussion in 'MCSD' started by Nice Chap, Feb 24, 2004.

  1. Nice Chap

    Nice Chap Guest

    Has anybody got some examples for SecurityAction.LinkDemand and
    SecurityAction.InheritanceDemand, please? I am quite not able to appreciate
    these two options and I was wondering if anybody had a real-life example
    where we might need to use these options.


    I have asked this question on the Security NG but to no avail !!
    Nice Chap, Feb 24, 2004
    #1
    1. Advertising

  2. >I am quite not able to appreciate
    >these two options and I was wondering if anybody had a real-life example
    >where we might need to use these options.


    Really it's just a trade off between performance vs the level of
    security checks performed.

    Kline Sphere (Chalk) MCNGP #3
    The Poster Formerly Known as Kline Sphere, Feb 24, 2004
    #2
    1. Advertising

  3. > Has anybody got some examples for SecurityAction.LinkDemand and
    > SecurityAction.InheritanceDemand, please?


    LinkDemand perfectly suits a situation when you need to retrict the use of
    your class only to applications known beforehand. Say, you use a modular
    approach in your app and you've developed an assembly containing some useful
    stuff. Since you don't want it to be reused by anyone, you can protect the
    stuff with LinkDemand so only callers with a certain public key will be
    allowed to use it.

    InheritanceDemand works almost the same way, but allows/denies to derive
    from a class, instead of using it as opposed to LinkDemand.

    --
    Dmitriy Lapshin [C# / .NET MVP]
    X-Unity Test Studio
    http://www.x-unity.net/teststudio.aspx
    Bring the power of unit testing to VS .NET IDE

    "Nice Chap" <> wrote in message
    news:uTJVhVw%...
    > Has anybody got some examples for SecurityAction.LinkDemand and
    > SecurityAction.InheritanceDemand, please? I am quite not able to

    appreciate
    > these two options and I was wondering if anybody had a real-life example
    > where we might need to use these options.
    >
    >
    > I have asked this question on the Security NG but to no avail !!
    >
    >
    Dmitriy Lapshin [C# / .NET MVP], Feb 25, 2004
    #3
  4. On Wed, 25 Feb 2004 15:05:49 +0200, "Dmitriy Lapshin [C# / .NET MVP]"
    <> wrote:

    >LinkDemand perfectly suits a situation when you need to retrict the use of
    >your class only to applications known beforehand. Say, you use a modular
    >approach in your app and you've developed an assembly containing some useful
    >stuff. Since you don't want it to be reused by anyone, you can protect the
    >stuff with LinkDemand so only callers with a certain public key will be
    >allowed to use it.


    Not necessarily. If the class was being 'used' by other code, you
    would want ensure the code further down the stack had the appropriate
    rights to perform the task in question; a LinkDemand would not achieve
    this.

    Kline Sphere (Chalk) MCNGP #3
    The Poster Formerly Known as Kline Sphere, Mar 2, 2004
    #4
  5. Hi,

    > Not necessarily. If the class was being 'used' by other code, you
    > would want ensure the code further down the stack had the appropriate
    > rights to perform the task in question; a LinkDemand would not achieve
    > this.


    Excellent correction! Indeed, LinkDemand is good if you want to put a
    restriction upon *immediate* callers.

    --
    Dmitriy Lapshin [C# / .NET MVP]
    X-Unity Test Studio
    http://www.x-unity.net/teststudio.aspx
    Bring the power of unit testing to VS .NET IDE

    "The Poster Formerly Known as Kline Sphere" <.> wrote in message
    news:p...
    > On Wed, 25 Feb 2004 15:05:49 +0200, "Dmitriy Lapshin [C# / .NET MVP]"
    > <> wrote:
    >
    > >LinkDemand perfectly suits a situation when you need to retrict the use

    of
    > >your class only to applications known beforehand. Say, you use a modular
    > >approach in your app and you've developed an assembly containing some

    useful
    > >stuff. Since you don't want it to be reused by anyone, you can protect

    the
    > >stuff with LinkDemand so only callers with a certain public key will be
    > >allowed to use it.

    >
    > Not necessarily. If the class was being 'used' by other code, you
    > would want ensure the code further down the stack had the appropriate
    > rights to perform the task in question; a LinkDemand would not achieve
    > this.
    >
    > Kline Sphere (Chalk) MCNGP #3
    Dmitriy Lapshin [C# / .NET MVP], Mar 3, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. General Protection Fault

    good document on code access security

    General Protection Fault, Nov 28, 2003, in forum: MCSD
    Replies:
    1
    Views:
    379
    Laurent Desmons
    Nov 28, 2003
  2. PB
    Replies:
    1
    Views:
    564
  3. =?Utf-8?B?QXRhbnUgTWFoYXRh?=

    MOC code and Exam code

    =?Utf-8?B?QXRhbnUgTWFoYXRh?=, Dec 28, 2006, in forum: MCSE
    Replies:
    28
    Views:
    986
  4. Replies:
    3
    Views:
    511
    Don_Luciano
    Mar 19, 2006
  5. General Protection Fault

    good document on code access security

    General Protection Fault, Nov 28, 2003, in forum: MCAD
    Replies:
    0
    Views:
    571
    General Protection Fault
    Nov 28, 2003
Loading...

Share This Page