0

I have a x509 certificate (PEM format) and I want to load it in Go so that I can extract the public key and the signature from it. Extracting the signature works fine, but when extracting the public key I get some padding + the public key.

Does anyone know why that padding is added and how I can remove it?

For example:

  • the public key is : 04acad3942581b4b1992586....
  • when extracting it in Go i get: 3076301006072a8648ce3d020106052b81040022036200[then pe public key]

The code looks like this:

pub_key_str := cert.RawSubjectPublicKeyInfo
pub_key_hex := hex.EncodeToString(pub_key_str)
kostix
  • 51,517
  • 14
  • 93
  • 176
Alexandra
  • 43
  • 4

0 Answers0