Add CompositeMLDsa CNG (NCrypt)#130053
Conversation
|
Tagging subscribers to this area: @bartonjs, @vcsjones, @dotnet/area-system-security |
| throw new PlatformNotSupportedException(SR.Format(SR.Cryptography_AlgorithmNotSupported, nameof(CompositeMLDsa))); | ||
| protected override int ExportCompositeMLDsaPrivateKeyCore(Span<byte> destination) => | ||
| CngPkcs8.AllowsOnlyEncryptedExport(_key) | ||
| ? throw new CryptographicException(SR.Cryptography_KeyNotExtractable) |
There was a problem hiding this comment.
How exactly is Windows failing? If they're giving an HR saying "no workey", then let's just go ahead and call them how we expect to, and maybe we don't have to come back and wire it up.
If they're A/V-ing or something, then, sure, throwing here is good.
Repeats to other places with the same check.
There was a problem hiding this comment.
Windows returns an error code for unsupported algo and we wrap it in an exception with an appropriate message.
| /// <value> | ||
| /// An object that specifies the Composite ML-DSA family of algorithms. | ||
| /// </value> | ||
| [Experimental(Experimentals.PostQuantumCryptographyDiagId, UrlFormat = Experimentals.SharedUrlFormat)] |
There was a problem hiding this comment.
I assume the [Experimental] is because the feature is only in insiders right now?
There was a problem hiding this comment.
The whole ietf-lamps-pq-composite-sigs is still a draft RFC.
| /// <inheritdoc/> | ||
| protected override int SignDataCore(ReadOnlySpan<byte> data, ReadOnlySpan<byte> context, Span<byte> destination) => | ||
| throw new PlatformNotSupportedException(SR.Format(SR.Cryptography_AlgorithmNotSupported, nameof(CompositeMLDsa))); | ||
| protected override int SignDataCore(ReadOnlySpan<byte> data, ReadOnlySpan<byte> context, Span<byte> destination) |
| /// <inheritdoc/> | ||
| protected override int ExportCompositeMLDsaPrivateKeyCore(Span<byte> destination) => | ||
| throw new PlatformNotSupportedException(SR.Format(SR.Cryptography_AlgorithmNotSupported, nameof(CompositeMLDsa))); | ||
| protected override bool VerifyDataCore(ReadOnlySpan<byte> data, ReadOnlySpan<byte> context, ReadOnlySpan<byte> signature) |
Wires up Composite ML-DSA CNG support.
The APIs in #130052 is pending approval so they're internal in this PR.
PKCS8 export does not work in Windows for Composite ML-DSA (yet), so encrypted export only keys can't currently be exported. Also, PKCS8 export is done by exporting the private key instead.