1 // Licensed to the .NET Foundation under one or more agreements. 2 // The .NET Foundation licenses this file to you under the MIT license. 3 // See the LICENSE file in the project root for more information. 4 5 using System; 6 using System.Runtime.InteropServices; 7 using System.Security; 8 9 namespace Microsoft.Win32.SafeHandles 10 { 11 internal sealed class SafeBignumHandle : SafeHandle 12 { SafeBignumHandle()13 private SafeBignumHandle() : 14 base(IntPtr.Zero, ownsHandle: true) 15 { 16 } 17 SafeBignumHandle(IntPtr handle, bool ownsHandle)18 internal SafeBignumHandle(IntPtr handle, bool ownsHandle) 19 : base(handle, ownsHandle) 20 { 21 } 22 ReleaseHandle()23 protected override bool ReleaseHandle() 24 { 25 Interop.Crypto.BigNumDestroy(handle); 26 SetHandle(IntPtr.Zero); 27 return true; 28 } 29 30 public override bool IsInvalid 31 { 32 get { return handle == IntPtr.Zero; } 33 } 34 } 35 } 36