Bastler schrieb:
> Geht nicht so, wie bei einem "normalen" Webserver, d.h. Zertifikate im
> Filesystem ablegen.
Warum nicht?
Du brauchst ja nur ein "SSLCert"-Objekt richtig zu initialisieren. Und
das geht aus zwei char* mit Längenangabe.
1 | class SSLCert {
|
2 | public:
|
3 | /**
|
4 | * \brief Creates a new SSLCert.
|
5 | *
|
6 | * The certificate and key data may be NULL (default values) if the certificate is meant
|
7 | * to be passed to createSelfSignedCert().
|
8 | *
|
9 | * Otherwise, the data must reside in a memory location that is not deleted until the server
|
10 | * using the certificate is stopped.
|
11 | *
|
12 | * \param[in] certData The certificate data to use (DER format)
|
13 | * \param[in] certLength The length of the certificate data
|
14 | * \param[in] pkData The private key data to use (DER format)
|
15 | * \param[in] pkLength The length of the private key
|
16 | */
|
17 | SSLCert(
|
18 | unsigned char * certData = NULL,
|
19 | uint16_t certLength = 0,
|
20 | unsigned char * pkData = NULL,
|
21 | uint16_t pkLength = 0
|
22 | );
|
23 | ...
|
d.H. garkein Problem, das aus Dateien zu lesen, solang du den Lesebuffer
nicht zu früh freigibst: ("the data must reside in a memory location
that is not deleted")
Nur vorher umwandeln in's DER-Format, direkt mit X509 - Ascii-Encoded
files kommt er nicht klar.1 | openssl rsa -in example.key -outform DER -out example.key.DER
|
2 | openssl x509 -in example.crt -outform DER -out example.crt.DER
|