diff --git a/src/libraries/Common/src/System/Security/Cryptography/X509Certificates/Pkcs12LoaderLimits.cs b/src/libraries/Common/src/System/Security/Cryptography/X509Certificates/Pkcs12LoaderLimits.cs
index 678e8ea6d78a34..c9c0a6a6f772d8 100644
--- a/src/libraries/Common/src/System/Security/Cryptography/X509Certificates/Pkcs12LoaderLimits.cs
+++ b/src/libraries/Common/src/System/Security/Cryptography/X509Certificates/Pkcs12LoaderLimits.cs
@@ -372,7 +372,12 @@ public bool IgnoreEncryptedAuthSafes
/// to fail loading when duplicate attributes are found.
/// The default is .
///
- internal bool AllowDuplicateAttributes
+#if NET10_0_OR_GREATER
+ public
+#else
+ internal
+#endif
+ bool AllowDuplicateAttributes
{
get => _allowDuplicateAttributes;
set
diff --git a/src/libraries/Common/tests/System/Security/Cryptography/X509Certificates/X509CertificateLoaderPkcs12CollectionTests.cs b/src/libraries/Common/tests/System/Security/Cryptography/X509Certificates/X509CertificateLoaderPkcs12CollectionTests.cs
index da5a2d6a7e929a..791c64ff9f87c4 100644
--- a/src/libraries/Common/tests/System/Security/Cryptography/X509Certificates/X509CertificateLoaderPkcs12CollectionTests.cs
+++ b/src/libraries/Common/tests/System/Security/Cryptography/X509Certificates/X509CertificateLoaderPkcs12CollectionTests.cs
@@ -178,7 +178,7 @@ public abstract partial class X509CertificateLoaderPkcs12CollectionTests
#if NETFRAMEWORK
X509KeyStorageFlags.DefaultKeySet;
#else
- PlatformDetection.UsesAppleCrypto ?
+ PlatformDetection.UsesAppleCrypto ?
X509KeyStorageFlags.DefaultKeySet :
X509KeyStorageFlags.EphemeralKeySet;
#endif
@@ -301,7 +301,7 @@ private void LoadKnownFormat_Fails(byte[] data, string path, X509ContentType con
Assert.Equal(contentType, actualType);
}
}
-
+
if (path is null)
{
Assert.ThrowsAny(() => LoadPfxNoFile(data));
@@ -749,14 +749,19 @@ public void LoadWithDuplicateAttributes(bool allowDuplicates)
{
Pkcs12LoaderLimits limits = Pkcs12LoaderLimits.Defaults;
+#if !NET10_0_OR_GREATER
if (allowDuplicates)
{
limits = Pkcs12LoaderLimits.DangerousNoLimits;
}
+#endif
// remove the edit lock
limits = new Pkcs12LoaderLimits(limits)
{
+#if NET10_0_OR_GREATER
+ AllowDuplicateAttributes = allowDuplicates,
+#endif
PreserveCertificateAlias = false,
PreserveKeyName = false,
PreserveStorageProvider = false,
diff --git a/src/libraries/Common/tests/System/Security/Cryptography/X509Certificates/X509CertificateLoaderPkcs12Tests.cs b/src/libraries/Common/tests/System/Security/Cryptography/X509Certificates/X509CertificateLoaderPkcs12Tests.cs
index b2005ab6052ac0..2c58efcda33a6d 100644
--- a/src/libraries/Common/tests/System/Security/Cryptography/X509Certificates/X509CertificateLoaderPkcs12Tests.cs
+++ b/src/libraries/Common/tests/System/Security/Cryptography/X509Certificates/X509CertificateLoaderPkcs12Tests.cs
@@ -179,7 +179,7 @@ public abstract partial class X509CertificateLoaderPkcs12Tests
#if NETFRAMEWORK
X509KeyStorageFlags.DefaultKeySet;
#else
- PlatformDetection.UsesAppleCrypto ?
+ PlatformDetection.UsesAppleCrypto ?
X509KeyStorageFlags.DefaultKeySet :
X509KeyStorageFlags.EphemeralKeySet;
#endif
@@ -302,7 +302,7 @@ private void LoadKnownFormat_Fails(byte[] data, string path, X509ContentType con
Assert.Equal(contentType, actualType);
}
}
-
+
if (path is null)
{
Assert.ThrowsAny(() => LoadPfxNoFile(data));
@@ -744,14 +744,19 @@ public void LoadWithDuplicateAttributes(bool allowDuplicates)
{
Pkcs12LoaderLimits limits = Pkcs12LoaderLimits.Defaults;
+#if !NET10_0_OR_GREATER
if (allowDuplicates)
{
limits = Pkcs12LoaderLimits.DangerousNoLimits;
}
+#endif
// remove the edit lock
limits = new Pkcs12LoaderLimits(limits)
{
+#if NET10_0_OR_GREATER
+ AllowDuplicateAttributes = allowDuplicates,
+#endif
PreserveCertificateAlias = false,
PreserveKeyName = false,
PreserveStorageProvider = false,
@@ -788,7 +793,7 @@ public void LoadWithLegacyProvider(bool preserveStorageProvider, bool ephemeralI
// EphemeralKeySet is not available by name in the netfx build.
const X509KeyStorageFlags EphemeralKeySet = (X509KeyStorageFlags)0x20;
- bool expectLegacy = (flags & EphemeralKeySet) == 0 && preserveStorageProvider;
+ bool expectLegacy = (flags & EphemeralKeySet) == 0 && preserveStorageProvider;
using (X509Certificate2 cert = LoadPfxNoFile(TestData.SChannelPfx, TestData.PlaceholderPw, flags, limits))
{
diff --git a/src/libraries/System.Security.Cryptography/ref/System.Security.Cryptography.cs b/src/libraries/System.Security.Cryptography/ref/System.Security.Cryptography.cs
index 5e945c446a2ed3..81bfc96492b27f 100644
--- a/src/libraries/System.Security.Cryptography/ref/System.Security.Cryptography.cs
+++ b/src/libraries/System.Security.Cryptography/ref/System.Security.Cryptography.cs
@@ -3386,6 +3386,7 @@ public sealed partial class Pkcs12LoaderLimits
{
public Pkcs12LoaderLimits() { }
public Pkcs12LoaderLimits(System.Security.Cryptography.X509Certificates.Pkcs12LoaderLimits copyFrom) { }
+ public bool AllowDuplicateAttributes { get { throw null; } set { } }
public static System.Security.Cryptography.X509Certificates.Pkcs12LoaderLimits DangerousNoLimits { get { throw null; } }
public static System.Security.Cryptography.X509Certificates.Pkcs12LoaderLimits Defaults { get { throw null; } }
public bool IgnoreEncryptedAuthSafes { get { throw null; } set { } }