Thank you for your answer.
Regarding your code, I don't know anything to Swift.
I tried to execute it on an online playground. Some errors showed, for example:
error: use of unresolved identifier 'kSecAttrKeyType' let attributes = [kSecAttrKeyType: kSecAttrKeyTypeEC,
Are some imports required?
So, what are you looking to do with a raw string here?
I'm trying to use an Apex method called Crypto.sign() whose last param, privateKey, is essentially a representation of a string ("Blob" type).
That's why I want to extract the private key info from my p8 APNs file, which contain both a private and a public keys.
https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_classes_restful_crypto.htm#apex_System_Crypto_sign