1.3 KiB
title | author | description | keywords | ms.author | manager | ms.date | ms.topic | ms.assetid | ms.technology | ms.prod | uid |
---|---|---|---|---|---|---|---|---|---|---|---|
Miscellaneous APIs | Microsoft Docs | rick-anderson | ASP.NET Core, | riande | wpickett | 10/14/2016 | article | 512c6ba7-88ec-47e4-a656-6b30350b34e6 | aspnet | aspnet-core | security/data-protection/extensibility/misc-apis |
Miscellaneous APIs
[!WARNING] Types that implement any of the following interfaces should be thread-safe for multiple callers.
ISecret
The ISecret interface represents a secret value, such as cryptographic key material. It contains the following API surface.
-
Length : int
-
Dispose() : void
-
WriteSecretIntoBuffer(ArraySegment buffer) : void
The WriteSecretIntoBuffer method populates the supplied buffer with the raw secret value. The reason this API takes the buffer as a parameter rather than returning a byte[] directly is that this gives the caller the opportunity to pin the buffer object, limiting secret exposure to the managed garbage collector.
The Secret type is a concrete implementation of ISecret where the secret value is stored in in-process memory. On Windows platforms, the secret value is encrypted via CryptProtectMemory.