-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Labels
needs-area-labelAn area label is needed to ensure this gets routed to the appropriate area ownersAn area label is needed to ensure this gets routed to the appropriate area ownersuntriagedNew issue has not been triaged by the area ownerNew issue has not been triaged by the area owner
Description
Type of issue
Outdated article
Description
The sample code provided includes:
alicePublicKey = alice.PublicKey.ToByteArray();
but ECDiffieHellmanPublicKey.ToByteArray()
is marked as Obsolete in current versions of dotnet, and what it produces throws when passed to CngKey.Import, at least for Curve25519. The recommended replacement, ECDiffieHellmanPublicKey.ExportSubjectPublicKeyInfo()
also throws for Curve25519.
The least bad replacement I could figure out is the very unsatisfying:
var alicePublicKey = (alice.PublicKey as ECDiffieHellmanCngPublicKey)!.Import().Export(CngKeyBlobFormat.EccFullPublicBlob);
and then
CngKey.Import(alicePublicKey, CngKeyBlobFormat.EccFullPublicBlob)
to create something that can be used with DeriveKeyMaterial() et al.
Page URL
Content source URL
Document Version Independent Id
f761f563-a2d2-32f8-f34e-3e88927076e4
Platform Id
6403fb7b-63f1-302c-9c2a-5c3f84f63994
Article author
Metadata
Metadata
Assignees
Labels
needs-area-labelAn area label is needed to ensure this gets routed to the appropriate area ownersAn area label is needed to ensure this gets routed to the appropriate area ownersuntriagedNew issue has not been triaged by the area ownerNew issue has not been triaged by the area owner