Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,12 @@ public abstract partial class SlhDsa : IDisposable
/// <param name="algorithm">
/// The specific SLH-DSA algorithm for this key.
/// </param>
/// <exception cref="ArgumentNullException">
/// <paramref name="algorithm" /> is <see langword="null" />.
/// </exception>
protected SlhDsa(SlhDsaAlgorithm algorithm)
{
ArgumentNullException.ThrowIfNull(algorithm);
Algorithm = algorithm;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ public static void NullArgumentValidation(SlhDsaAlgorithm algorithm, bool should
AssertExtensions.Throws<ArgumentNullException>("pbeParameters", () => slhDsa.TryExportEncryptedPkcs8PrivateKey(string.Empty, null, Span<byte>.Empty, out _));
}

[Fact]
public static void ArgumentValidation_Ctor_NullAlgorithm()
{
AssertExtensions.Throws<ArgumentNullException>("algorithm", static () => new SlhDsaMockImplementation(null));
}

[Theory]
[MemberData(nameof(ArgumentValidationData))]
public static void ArgumentValidation(SlhDsaAlgorithm algorithm, bool shouldDispose)
Expand Down Expand Up @@ -95,7 +101,7 @@ public static void ArgumentValidation_PbeParameters(SlhDsaAlgorithm algorithm, b
SlhDsaTestHelpers.AssertEncryptedExportPkcs8PrivateKey(export =>
{
// Unknown algorithm
AssertExtensions.Throws<CryptographicException>(() =>
AssertExtensions.Throws<CryptographicException>(() =>
export(slhDsa, "PLACEHOLDER", new PbeParameters(PbeEncryptionAlgorithm.Unknown, HashAlgorithmName.SHA1, 42)));

// TripleDes3KeyPkcs12 only works with SHA1
Expand Down
Loading