From 87a92e52c8b4bb7cb75ff78d53d641b1d34f8775 Mon Sep 17 00:00:00 2001 From: David Fowler Date: Fri, 12 Jul 2019 22:29:54 -0700 Subject: [PATCH] Make some pubternal types in data protection (#12121) - Make CngAuthenticatedEncryptorBase internal - Left IActivator public because they are used in constructors the XmlKeyManager ctor --- ...AspNetCore.DataProtection.netstandard2.0.cs | 18 ------------------ .../Internal/CngAuthenticatedEncryptorBase.cs | 2 +- .../src/Internal/DataProtectionBuilder.cs | 2 +- .../Cng/CngAuthenticatedEncryptorBaseTests.cs | 2 +- 4 files changed, 3 insertions(+), 21 deletions(-) diff --git a/src/DataProtection/DataProtection/ref/Microsoft.AspNetCore.DataProtection.netstandard2.0.cs b/src/DataProtection/DataProtection/ref/Microsoft.AspNetCore.DataProtection.netstandard2.0.cs index badd03a3ce..70cd9bfe67 100644 --- a/src/DataProtection/DataProtection/ref/Microsoft.AspNetCore.DataProtection.netstandard2.0.cs +++ b/src/DataProtection/DataProtection/ref/Microsoft.AspNetCore.DataProtection.netstandard2.0.cs @@ -217,26 +217,8 @@ namespace Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.Configurat public System.Xml.Linq.XElement SerializedDescriptorElement { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } } } -namespace Microsoft.AspNetCore.DataProtection.Cng.Internal -{ - public abstract partial class CngAuthenticatedEncryptorBase : Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.IAuthenticatedEncryptor, System.IDisposable - { - protected CngAuthenticatedEncryptorBase() { } - public byte[] Decrypt(System.ArraySegment ciphertext, System.ArraySegment additionalAuthenticatedData) { throw null; } - protected unsafe abstract byte[] DecryptImpl(byte* pbCiphertext, uint cbCiphertext, byte* pbAdditionalAuthenticatedData, uint cbAdditionalAuthenticatedData); - public abstract void Dispose(); - public byte[] Encrypt(System.ArraySegment plaintext, System.ArraySegment additionalAuthenticatedData) { throw null; } - public byte[] Encrypt(System.ArraySegment plaintext, System.ArraySegment additionalAuthenticatedData, uint preBufferSize, uint postBufferSize) { throw null; } - protected unsafe abstract byte[] EncryptImpl(byte* pbPlaintext, uint cbPlaintext, byte* pbAdditionalAuthenticatedData, uint cbAdditionalAuthenticatedData, uint cbPreBuffer, uint cbPostBuffer); - } -} namespace Microsoft.AspNetCore.DataProtection.Internal { - public partial class DataProtectionBuilder : Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder - { - public DataProtectionBuilder(Microsoft.Extensions.DependencyInjection.IServiceCollection services) { } - public Microsoft.Extensions.DependencyInjection.IServiceCollection Services { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } - } public partial interface IActivator { object CreateInstance(System.Type expectedBaseType, string implementationTypeName); diff --git a/src/DataProtection/DataProtection/src/Cng/Internal/CngAuthenticatedEncryptorBase.cs b/src/DataProtection/DataProtection/src/Cng/Internal/CngAuthenticatedEncryptorBase.cs index 7b7e3e2d79..a6f9bef9eb 100644 --- a/src/DataProtection/DataProtection/src/Cng/Internal/CngAuthenticatedEncryptorBase.cs +++ b/src/DataProtection/DataProtection/src/Cng/Internal/CngAuthenticatedEncryptorBase.cs @@ -9,7 +9,7 @@ namespace Microsoft.AspNetCore.DataProtection.Cng.Internal /// /// Base class used for all CNG-related authentication encryption operations. /// - public unsafe abstract class CngAuthenticatedEncryptorBase : IOptimizedAuthenticatedEncryptor, IDisposable + internal unsafe abstract class CngAuthenticatedEncryptorBase : IOptimizedAuthenticatedEncryptor, IDisposable { public byte[] Decrypt(ArraySegment ciphertext, ArraySegment additionalAuthenticatedData) { diff --git a/src/DataProtection/DataProtection/src/Internal/DataProtectionBuilder.cs b/src/DataProtection/DataProtection/src/Internal/DataProtectionBuilder.cs index bc8908c9c4..53ec101992 100644 --- a/src/DataProtection/DataProtection/src/Internal/DataProtectionBuilder.cs +++ b/src/DataProtection/DataProtection/src/Internal/DataProtectionBuilder.cs @@ -9,7 +9,7 @@ namespace Microsoft.AspNetCore.DataProtection.Internal /// /// Default implementation of . /// - public class DataProtectionBuilder : IDataProtectionBuilder + internal class DataProtectionBuilder : IDataProtectionBuilder { /// /// Creates a new configuration object linked to a . diff --git a/src/DataProtection/DataProtection/test/Cng/CngAuthenticatedEncryptorBaseTests.cs b/src/DataProtection/DataProtection/test/Cng/CngAuthenticatedEncryptorBaseTests.cs index faedbf44e9..dd439785f4 100644 --- a/src/DataProtection/DataProtection/test/Cng/CngAuthenticatedEncryptorBaseTests.cs +++ b/src/DataProtection/DataProtection/test/Cng/CngAuthenticatedEncryptorBaseTests.cs @@ -86,7 +86,7 @@ namespace Microsoft.AspNetCore.DataProtection.Cng.Internal Assert.Equal(new byte[] { 0x20, 0x21, 0x22 }, retVal); } - public abstract class MockableEncryptor : CngAuthenticatedEncryptorBase + internal abstract class MockableEncryptor : CngAuthenticatedEncryptorBase { public override void Dispose() {