OS4X Core - changing certificate format (PEM & DER)

From OS4X
Revision as of 15:40, 6 November 2012 by Admin (talk | contribs) (New page: Some systems (mainly Windows systems) rely on the correct certificate format and/or filename extension. For these, it's important to provide certificates in the requested format. '''In OS...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Some systems (mainly Windows systems) rely on the correct certificate format and/or filename extension. For these, it's important to provide certificates in the requested format.

In OS4X, (nearly) all certificates files are used in PEM format. This format is ASCII based, but not human-readable. Example:

-----BEGIN CERTIFICATE-----
MIIIDjCCA/agAwIBAgIKDHqkbqj+u6Pu5zANBgkqhkiG9w0BAQUFADCBizELMAkG
A1UEBhMCREUxFjAUBgNVBAcMDUhvbHpnZXJsaW5nZW4xFTATBgNVBAoMDGMtd29y
a3MgR21iSDEVMBMGA1UECwwMQ2VydGlmaWNhdGVzMREwDwYDVQQDDAhPRlRQMiBD
....
....
XzzlP6zaRt8unDhj35nUzCdXUYsm9b1zgSJYuE5B7vu+aMB4/T9i1DhLn8RopIVg
/vJihDj34jNKGRFMAIlLirvpn7nJJ2NIE0u+cpF70IcDkZ9Wqduy7OUr+PRz5wB+
1ZOcWL2hOIxxNP5PcqIYAiwmvjDXfgzJqbPw1qoPYQRxHSo+cMLHDq+7U9cC0AMR
8/o=
-----END CERTIFICATE-----

In Windows, these files may have the following file extensions:

.cer
.pem

Depending on your system, you can directly import these certificates.

Converting line ending

If the Windows based system is not able to import your certificate, it may be needed to change the Unix line ending ("line feed") to the Windows format ("carriage return & line feed"). You can make this conversion in several ways:

root@os4xbox:/tmp# unix2dos certificateFile.cer
unix2dos: File certificateFile.cer will be formatted to DOS format ...

Using "sed" (i.e. if "unix2dos" is not installed):

sed 's/$'"/`echo \\\r`/" certificateFile.cer > certificateFile_windows.cer