I have an OpenSSL CMS container that looks like this:
-----BEGIN CMS-----
MIIB8wYJKoZIhvcNAQcDoIIB5DCCAeACAQIxggFbMIIBVwIBAoAULnkcmzlVKA2n
...
VHlK2XDa0mvNQBn3dbwKTuENUizo1kg=
-----END CMS-----
This CMS container can be decrypted with an private key that looks like this:
-----BEGIN ENCRYPTED PRIVATE KEY-----
MIIFHzBJBgkqhkiG9w0BBQ0wPDAbBgkqhkiG9w0BBQwwDgQItDyAwApAzCkCAggA
...
cZwaM/68l8G0qc4B6EyqgCIF0A==
-----END ENCRYPTED PRIVATE KEY-----
Also I can decrypt it with an OpenSSL command line:
openssl cms -decrypt -in cms-container.txt -inkey private-key.pem -inform PEM
Now I will implement it in Go, but at this time I have only one idea: via exec.Command()
:
cmd.Command("openssl", "cms -decrypt -in cms-container.txt -inkey private-key.pem -inform PEM")
This is a very dirty way and would rather use a library.
Have anyone an idea which library is usefull for this or how can I implement it?
Thanks you all!