mirror of
https://github.com/apple/swift-crypto
synced 2026-11-24 04:37:48 +00:00
Motivation: At times we might need to get the raw elements of an RSA key, e.g when debugging. Modifications: Add a getKeyPrimitives method to the RSA (public and private) key structures that returns the elements. To do this we leverage the built in BoringSSL methods (CCryptoBoringSSL_RSA_get0_n etc.) which return the raw elements of the key. In the Security version of the key we convert the key to a BoringSSL one and just call the BoringSSL method. Once we get ASN.1 support in _CryptoExtras it might make sense switching the implementation of this method to decode the ASN.1 structure and returns the elements from there. Result: New APIs to fetch the key primitives. --------- Co-authored-by: Cory Benfield <lukasa@apple.com>