Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WCF / Tools / WSATConfig / Configuration / SafeCertificateContext.cs / 1305376 / SafeCertificateContext.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace Microsoft.Tools.ServiceModel.WsatConfig { using System; using System.Security; using System.Security.Permissions; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; using System.Runtime.ConstrainedExecution; using Microsoft.Win32.SafeHandles; using System.Security.Cryptography.X509Certificates; internal sealed class SafeCertificateContext : SafeHandleZeroOrMinusOneIsInvalid { [SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode = true)] internal SafeCertificateContext() : base(false) { } public override bool IsInvalid { get { return handle == IntPtr.Zero; } } protected override bool ReleaseHandle() { // Returns a Win32 error code, 0 for success int r = SafeNativeMethods.CertFreeCertificateContext(handle); return r == 0; } internal X509Certificate2 GetNewX509Certificate() { return new X509Certificate2(handle); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace Microsoft.Tools.ServiceModel.WsatConfig { using System; using System.Security; using System.Security.Permissions; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; using System.Runtime.ConstrainedExecution; using Microsoft.Win32.SafeHandles; using System.Security.Cryptography.X509Certificates; internal sealed class SafeCertificateContext : SafeHandleZeroOrMinusOneIsInvalid { [SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode = true)] internal SafeCertificateContext() : base(false) { } public override bool IsInvalid { get { return handle == IntPtr.Zero; } } protected override bool ReleaseHandle() { // Returns a Win32 error code, 0 for success int r = SafeNativeMethods.CertFreeCertificateContext(handle); return r == 0; } internal X509Certificate2 GetNewX509Certificate() { return new X509Certificate2(handle); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- UpdatableWrapper.cs
- EnumConverter.cs
- Char.cs
- CompositeFontInfo.cs
- XmlSchemaSimpleTypeRestriction.cs
- DispatchChannelSink.cs
- HttpModuleCollection.cs
- XPathNodeIterator.cs
- StructuralCache.cs
- IgnorePropertiesAttribute.cs
- Blend.cs
- XPathAncestorIterator.cs
- ProfileGroupSettings.cs
- EncoderExceptionFallback.cs
- RenderContext.cs
- TextAnchor.cs
- ToolStripDesignerAvailabilityAttribute.cs
- ModulesEntry.cs
- FullTrustAssemblyCollection.cs
- QuinticEase.cs
- BitmapEffectGroup.cs
- VariableQuery.cs
- IncrementalCompileAnalyzer.cs
- QuaternionAnimation.cs
- VariableQuery.cs
- SortableBindingList.cs
- DashStyles.cs
- IPEndPointCollection.cs
- WeakReadOnlyCollection.cs
- WebResourceUtil.cs
- BindingGroup.cs
- CodeChecksumPragma.cs
- ColumnCollection.cs
- ManifestSignatureInformation.cs
- BorderGapMaskConverter.cs
- MaskedTextBoxTextEditor.cs
- DataBoundControl.cs
- RunClient.cs
- InstanceCompleteException.cs
- X509UI.cs
- BitmapCodecInfoInternal.cs
- AbandonedMutexException.cs
- EndOfStreamException.cs
- TemplateXamlParser.cs
- ProcessHostMapPath.cs
- TreeNodeEventArgs.cs
- HtmlInputHidden.cs
- SimpleLine.cs
- TransformConverter.cs
- DropSource.cs
- LambdaExpression.cs
- Icon.cs
- ContractHandle.cs
- SqlCommandBuilder.cs
- OuterGlowBitmapEffect.cs
- DataGridPreparingCellForEditEventArgs.cs
- BuiltInExpr.cs
- Rijndael.cs
- RuntimeArgumentHandle.cs
- FullTextLine.cs
- Section.cs
- ToolStripItemTextRenderEventArgs.cs
- MenuItem.cs
- XPathNavigatorException.cs
- MenuItemStyleCollection.cs
- AsymmetricKeyExchangeDeformatter.cs
- FilterQuery.cs
- FixedHighlight.cs
- MinMaxParagraphWidth.cs
- SharedPerformanceCounter.cs
- GridViewHeaderRowPresenter.cs
- EndOfStreamException.cs
- ListChangedEventArgs.cs
- NCryptSafeHandles.cs
- RenderOptions.cs
- HandleCollector.cs
- WebBrowserProgressChangedEventHandler.cs
- LinqDataSource.cs
- Exceptions.cs
- TemplateAction.cs
- ViewBase.cs
- Accessible.cs
- PointKeyFrameCollection.cs
- XamlToRtfParser.cs
- LinqDataSourceUpdateEventArgs.cs
- WebBrowserNavigatedEventHandler.cs
- MostlySingletonList.cs
- MenuItemCollection.cs
- BitmapMetadataBlob.cs
- documentsequencetextview.cs
- ListViewAutomationPeer.cs
- XmlNodeChangedEventArgs.cs
- EmbeddedMailObject.cs
- TextBox.cs
- HashCodeCombiner.cs
- WindowsListViewGroup.cs
- ToolStripSplitButton.cs
- ResetableIterator.cs
- KerberosTicketHashIdentifierClause.cs
- XmlIlVisitor.cs