securitycriticaldataClass.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / Shared / MS / Internal / securitycriticaldataClass.cs / 1 / securitycriticaldataClass.cs

                            //---------------------------------------------------------------------------- 
//
// 
//    Copyright (C) Microsoft Corporation.  All rights reserved.
//  
//
// Description: 
//              This is a helper struct to facilate the storage of Security critical data ( aka "Plutonium") 
//              It's primary purpose is to do put a [SecurityCritical] on all access to the data.
// 
//              What is "critical data" ? This is any data created that required an Assert for it's creation.
//              As an example - the creation of an HwndWrapper during Dispatcher.Attach.
//              The current implementation requires the consumer to use the data member only if IsValid is true
// 
// History:
//  10/25/05 : akaza Created. 
// 
//---------------------------------------------------------------------------
using System ; 
using System.Security ;

#if WINDOWS_BASE
    using MS.Internal.WindowsBase; 
#elif PRESENTATION_CORE
    using MS.Internal.PresentationCore; 
#elif PRESENTATIONFRAMEWORK 
    using MS.Internal.PresentationFramework;
#elif DRT 
    using MS.Internal.Drt;
#else
#error Attempt to use FriendAccessAllowedAttribute from an unknown assembly.
using MS.Internal.YourAssemblyName; 
#endif
 
namespace MS.Internal 
{
    [FriendAccessAllowed] 
    internal class SecurityCriticalDataClass
    {
        /// 
        /// Critical - as this accesses _value which is Critical. 
        /// Safe - as the caller already got the critical value.
        ///  
        [SecurityCritical, SecurityTreatAsSafe] 
        internal SecurityCriticalDataClass(T value)
        { 
            _value = value;
        }

        //  
        //    Critical "by definition" - this class is intended only to store critical data.
        //  
        internal T Value 
        {
            [SecurityCritical] 
            get
            {
                return _value;
            } 
        }
 
 
        /// 
        /// Critical - by definition as this is a wrapper for Critical data. 
        /// 
        [SecurityCritical]
        private T _value;
    } 
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
//---------------------------------------------------------------------------- 
//
// 
//    Copyright (C) Microsoft Corporation.  All rights reserved.
//  
//
// Description: 
//              This is a helper struct to facilate the storage of Security critical data ( aka "Plutonium") 
//              It's primary purpose is to do put a [SecurityCritical] on all access to the data.
// 
//              What is "critical data" ? This is any data created that required an Assert for it's creation.
//              As an example - the creation of an HwndWrapper during Dispatcher.Attach.
//              The current implementation requires the consumer to use the data member only if IsValid is true
// 
// History:
//  10/25/05 : akaza Created. 
// 
//---------------------------------------------------------------------------
using System ; 
using System.Security ;

#if WINDOWS_BASE
    using MS.Internal.WindowsBase; 
#elif PRESENTATION_CORE
    using MS.Internal.PresentationCore; 
#elif PRESENTATIONFRAMEWORK 
    using MS.Internal.PresentationFramework;
#elif DRT 
    using MS.Internal.Drt;
#else
#error Attempt to use FriendAccessAllowedAttribute from an unknown assembly.
using MS.Internal.YourAssemblyName; 
#endif
 
namespace MS.Internal 
{
    [FriendAccessAllowed] 
    internal class SecurityCriticalDataClass
    {
        /// 
        /// Critical - as this accesses _value which is Critical. 
        /// Safe - as the caller already got the critical value.
        ///  
        [SecurityCritical, SecurityTreatAsSafe] 
        internal SecurityCriticalDataClass(T value)
        { 
            _value = value;
        }

        //  
        //    Critical "by definition" - this class is intended only to store critical data.
        //  
        internal T Value 
        {
            [SecurityCritical] 
            get
            {
                return _value;
            } 
        }
 
 
        /// 
        /// Critical - by definition as this is a wrapper for Critical data. 
        /// 
        [SecurityCritical]
        private T _value;
    } 
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK