I'm trying to parse the developer certificate in embedded.mobileprovision file. Firstly I use
security cms -D -i embedded.mobileprovision
to get the base64 developer certificate string.
Then I split the string every 64 characters and stored in a file named dev.cer.
Finally add -----BEGIN CERTIFICATE-----
at the first line and -----END CERTIFICATE-----
at the end of file.
On my mac computer, I right click the dev.cer file and the developer informations are all there. However, When I use openssl x509 -in dev.cer -text -noout
, error comes out:
unable to load certificate 69721:error:0906D066:PEM routines:PEM_read_bio:bad end line:/BuildRoot/Library/Caches/com.apple.xbs/Sources/OpenSSL098/OpenSSL098-64.50.6/src/crypto/pem/pem_lib.c:747:
The dev.cer file is following:
-----BEGIN CERTIFICATE----- MIIFljCCBH6gAwIBAgIIIP7GMO9cWzYwDQYJKoZIhvcNAQELBQAwgZYxCzAJBgNV BAYTAlVTMRMwEQYDVQQKDApBcHBsZSBJbmMuMSwwKgYDVQQLDCNBcHBsZSBXb3Js ZHdpZGUgRGV2ZWxvcGVyIFJlbGF0aW9uczFEMEIGA1UEAww7QXBwbGUgV29ybGR3 aWRlIERldmVsb3BlciBSZWxhdGlvbnMgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkw HhcNMTcwNDI5MDMzMDA4WhcNMTgwNDI5MDMzMDA4WjCBiTEaMBgGCgmSJomT8ixk AQEMCk1ENFA0UTg1WlExMzAxBgNVBAMMKmlQaG9uZSBEZXZlbG9wZXI6IGFtbW1p IGFtbW1pIChXM1BSS1JDVDRRKTETMBEGA1UECwwKVktRNTZVQ0c4ODEUMBIGA1UE CgwLYW1tbWkgYW1tbWkxCzAJBgNVBAYTAlVTMIIBIjANBgkqhkiG9w0BAQEFAAOC AQ8AMIIBCgKCAQEAwudboPuPnImOssBCw9vISRnnivreVwOuDAu77u47zIU8uTag bzktX6pF54YToSLQHeOaNNQfZ7idccU2DKVBr3etz/++ca4HNadeUaEm2VWW4kEq 3iKIo1wZZhJJR6bQl4q797U0+f7eEXLKD4fjfidEF+ceAxAsX5YIuokq3K/B+XW3 tKk7D4nCaaCyJ9/+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mbJbvkLFh2UCgqtE9moLYI8qFMzqe CQUJdPGdE+2WNv0wM8/cFIG/audSvEADKg1DgO+j6oP+urUe1gLsyzyv10J7/XA4 nmDuP1UNG7O7ADbdEOxhRiB96ZNwgcw9Q0wv9H9jMa+NNti6SxLud2+B -----END CERTIFICATE----
By the way, I used online certificate decoder to decode dev.cer, it works well. Here is the url:
https://www.sslshopper.com/certificate-decoder.html
This site recommended to use openssl, but it failed.
I had the same problem as sunnycomes and his comment was correct. I was lacking a '-' at the very end of the last line of the file. Before I had:
-----END CERTIFICATE----
and changing it to:
-----END CERTIFICATE-----
fixed it. I've learnt that I have to be careful when copying certificates text from a terminal.
Extra note: When pem file contains CA and sub-CA chain, be sure that -----END CERTIFICATE----
-----BEGIN CERTIFICATE-----
are not on the same line.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With