henrinormak / Heimdall

Heimdall is a wrapper around the Security framework for simple encryption/decryption operations.
MIT License
401 stars 68 forks source link

Format of x509 #79

Closed SlaveMast3r closed 4 years ago

SlaveMast3r commented 4 years ago

Hello,

I need PEM formatted X.509 certificate to share with my backend server.

I using function heimdall.publicKeyDataX509() and then convert result data, to base64 using .base64EncodedString(). But I'm not able to tell what format of certificate it is. Because even when I add Begin/End Certificate Im not able to validate it.

How can I obtain valid x509 pem format certificate?

SlaveMast3r commented 4 years ago

I found answer by myself. Heimdall is creating only rsa keys, so export is made as "pem: public key". So format is like below (but without begin/end sections) and could be verified with various pages or openssl.

-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnD6sFeCJf9bR7PH/YisP
wCePMUltELq/hp/Dm409XU/yEbgBTI/wMUnH+2juOTYeCirOB10bc/QrFVhaLV3g
HWyvSL+Wv0ufdWeZiLXAnICNddiJCQvOU+5seNUoPw4QKvFAQgZLogsjWm2uajJS
nSGskVCt48gaWVrIiO4OQZVkSTxXrUNknenXJ9b2bXam/Bt1ya1E1t1/b/ITZ/03
WQjfGwXgctqYytvAHC3v541s9o53J2uWn/pOBJc2058Ad5WyzqPRHzA1gbl+XinK
s85X5U5PAwJiVCsSyCFkNGwJmmuCPtrHipwZi5ax5jfrb71Plilj2VOXdrR2zU7F
OQIDAQAB
-----END PUBLIC KEY-----