Skip to content

Add PKCS#8, SPKI and PEM support for SLH-DSA #114943

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions src/libraries/Common/src/System/ExceptionPolyfills.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,36 @@ public static void ThrowIfNull([NotNull] object? argument, [CallerArgumentExpres
[DoesNotReturn]
private static void ThrowArgumentNullException(string? paramName) =>
throw new ArgumentNullException(paramName);

extension(ObjectDisposedException)
{
public static void ThrowIf([DoesNotReturnIf(true)] bool condition, object instance)
{
if (condition)
{
ThrowObjectDisposedException(instance);
}
}

public static void ThrowIf([DoesNotReturnIf(true)] bool condition, Type type)
{
if (condition)
{
ThrowObjectDisposedException(type);
}
}
}

[DoesNotReturn]
private static void ThrowObjectDisposedException(object? instance)
{
throw new ObjectDisposedException(instance?.GetType().FullName);
}

[DoesNotReturn]
private static void ThrowObjectDisposedException(Type? type)
{
throw new ObjectDisposedException(type?.FullName);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,6 @@ public override void Unpin()
// nop
}

private void ThrowIfDisposed()
{
#if NET
ObjectDisposedException.ThrowIf(_length < 0, this);
#else
if (_length < 0)
{
throw new ObjectDisposedException(GetType().FullName);
}
#endif
}
private void ThrowIfDisposed() => ObjectDisposedException.ThrowIf(_length < 0, this);
}
}
178 changes: 104 additions & 74 deletions src/libraries/Common/src/System/Security/Cryptography/MLKem.cs

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions src/libraries/Common/src/System/Security/Cryptography/Oids.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,24 +110,24 @@ internal static partial class Oids
internal const string SlhDsaSha2_192f = "2.16.840.1.101.3.4.3.23";
internal const string SlhDsaSha2_256s = "2.16.840.1.101.3.4.3.24";
internal const string SlhDsaSha2_256f = "2.16.840.1.101.3.4.3.25";
internal const string SlhDsaShake_128s = "2.16.840.1.101.3.4.3.26";
internal const string SlhDsaShake_128f = "2.16.840.1.101.3.4.3.27";
internal const string SlhDsaShake_192s = "2.16.840.1.101.3.4.3.28";
internal const string SlhDsaShake_192f = "2.16.840.1.101.3.4.3.29";
internal const string SlhDsaShake_256s = "2.16.840.1.101.3.4.3.30";
internal const string SlhDsaShake_256f = "2.16.840.1.101.3.4.3.31";
internal const string SlhDsaShake128s = "2.16.840.1.101.3.4.3.26";
internal const string SlhDsaShake128f = "2.16.840.1.101.3.4.3.27";
internal const string SlhDsaShake192s = "2.16.840.1.101.3.4.3.28";
internal const string SlhDsaShake192f = "2.16.840.1.101.3.4.3.29";
internal const string SlhDsaShake256s = "2.16.840.1.101.3.4.3.30";
internal const string SlhDsaShake256f = "2.16.840.1.101.3.4.3.31";
internal const string SlhDsaSha2_128sPreHashSha256 = "2.16.840.1.101.3.4.3.35";
internal const string SlhDsaSha2_128fPreHashSha256 = "2.16.840.1.101.3.4.3.36";
internal const string SlhDsaSha2_192sPreHashSha512 = "2.16.840.1.101.3.4.3.37";
internal const string SlhDsaSha2_192fPreHashSha512 = "2.16.840.1.101.3.4.3.38";
internal const string SlhDsaSha2_256sPreHashSha512 = "2.16.840.1.101.3.4.3.39";
internal const string SlhDsaSha2_256fPreHashSha512 = "2.16.840.1.101.3.4.3.40";
internal const string SlhDsaShake_128sPreHashShake128 = "2.16.840.1.101.3.4.3.41";
internal const string SlhDsaShake_128fPreHashShake128 = "2.16.840.1.101.3.4.3.42";
internal const string SlhDsaShake_192sPreHashShake256 = "2.16.840.1.101.3.4.3.43";
internal const string SlhDsaShake_192fPreHashShake256 = "2.16.840.1.101.3.4.3.44";
internal const string SlhDsaShake_256sPreHashShake256 = "2.16.840.1.101.3.4.3.45";
internal const string SlhDsaShake_256fPreHashShake256 = "2.16.840.1.101.3.4.3.46";
internal const string SlhDsaShake128sPreHashShake128 = "2.16.840.1.101.3.4.3.41";
internal const string SlhDsaShake128fPreHashShake128 = "2.16.840.1.101.3.4.3.42";
internal const string SlhDsaShake192sPreHashShake256 = "2.16.840.1.101.3.4.3.43";
internal const string SlhDsaShake192fPreHashShake256 = "2.16.840.1.101.3.4.3.44";
internal const string SlhDsaShake256sPreHashShake256 = "2.16.840.1.101.3.4.3.45";
internal const string SlhDsaShake256fPreHashShake256 = "2.16.840.1.101.3.4.3.46";

internal const string Mgf1 = "1.2.840.113549.1.1.8";
internal const string PSpecified = "1.2.840.113549.1.1.9";
Expand Down
Loading
Loading