#229 Add a PEM validity checker and validate SCEP CA files
Merged by rcritten. Opened by rcritten.
rcritten/certmonger bz1492112  into  master

If a non-PEM file was passed into add-scep-ca it would
accept it without question but later fail with:

status: CA_UNREACHABLE
ca-error: Error: failed to verify signature on server response.

Try to do basic validation of user-provided PEM files by:

  • stripping BEGIN/END headers
  • removing newlines and carriage returns
  • using OpenSSL EVP library to base64 decode the block

This isn't fool-proof but it at least does some basic
sanity checking to ensure the file(s) exist and appear
to be PEM files.

The unit tests use some Let's Encrypt CA certificates.

https://bugzilla.redhat.com/show_bug.cgi?id=1492112

Signed-off-by: Rob Crittenden rcritten@redhat.com

Ran this change through Coverity. Addressing some issues it turned up.

rebased onto d9e1e2808c251abb8257998979b125ba87184c31

rebased onto 94e09df2a6baf50558cf66ac9c035fb0865d8b43

rebased onto f986d5a1468101b33b2ad0044fd2ca0bb9a738a0

rebased onto fe0b1a212b0448d5c34deac9ad8a30f45c7f0a65

Pull-Request has been merged by rcritten