I am trying to import my secp256k1 private key into AWS KMS. My key is PEM formatted and AWS KMS says 'The key material must be in binary format' . How do I go about converting my ECDSA secp256k1 PEM formatted private key to binary?
            Asked
            
        
        
            Active
            
        
            Viewed 367 times
        
    1
            
            
        - 
                    Welcome to SO. Is this of any relevance? https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys-encrypt-key-material.html – Anton Krug Apr 14 '21 at 16:54
 - 
                    1Thanks @AntonKrug, I was following the same guide but it doesn't have any instructions on how to convert an existing pem key to binary. However, I found the solution and will post it as an answer for better visibility for others. – Priyesh Shah Apr 14 '21 at 23:55
 - 
                    Great you found the solution :) – Anton Krug Apr 15 '21 at 00:00
 
1 Answers
2
            
            
        For others who are looking, found this on GCP.
openssl pkcs8 -topk8 -nocrypt -inform PEM -outform DER \
    -in /path/to/asymmetric-key-pem \
    -out /path/to/formatted-key
        Priyesh Shah
        
- 31
 - 2