serenity icon indicating copy to clipboard operation
serenity copied to clipboard

LibCrypto: Implement ASN1 and DER encoding for common key fields

Open ADKaster opened this issue 2 years ago • 0 comments

Part of Web Crypto is the ability to export Keys in SubjectPublicKeyInfo format per RFC 5280

For example, RSA-OAEP as used by Discord for generating QR codes for login requires this format.

https://w3c.github.io/webcrypto/#rsa-oaep-operations

  1. Let data be an instance of the subjectPublicKeyInfo ASN.1 structure defined in [RFC5280] with the following properties:
  • Set the algorithm field to an AlgorithmIdentifier ASN.1 type with the following properties:

    • Set the algorithm field to the OID rsaEncryption defined in [RFC3447].

    • Set the params field to the ASN.1 type NULL.

  • Set the subjectPublicKey field to the result of DER-encoding an RSAPublicKey ASN.1 type, as defined in [RFC3447], Appendix A.1.1, that represents the RSA public key represented by the [[handle]] internal slot of key

Related to #23484

ADKaster avatar Mar 12 '24 17:03 ADKaster