0

I've been given a certificate and told to encrypt a file using openssl.

  1. This certificate is a .cer file, so I need to create a .pem file first. I have tried doing this using macOS's Keychain Access, and also using openssl in the terminal. They result in the same file, which starts with -----BEGIN CERTIFICATE-----.
  2. I run the following command

    openssl pkeyutl -encrypt -inkey certificate.pem -pubin -in key.xml -pkeyopt rsa_padding_mode:oaep -pkeyopt rsa_oaep_md:sha256 -pkeyopt rsa_mgf1_md:sha256 -out key.xml.enc
    
  3. I get the error

unable to load Public Key Error initializing context 4799456876:error:0906D06C:PEM routines:PEM_read_bio:no start line:pem_lib.c:697:Expecting: PUBLIC KEY

Am I using the wrong tools or the wrong approach? Any help is appreciated :)

Dave
  • 3,073
  • 7
  • 20
  • 33
thijsdemaa
  • 326
  • 1
  • 3
  • 11

0 Answers0