Arno Garrels wrote: > jlist wrote: >> What I want to do is to avoid providing the two .pem files as >> separate files. Instead, I'd like to read the content of the two >> files and hard-code them in a string variable, or in resource. > > Private Key and certificate may exist in the same file. > It's not a method in TX509Base, however you can derive your > own class and add this functionality. Something like below > should do the trick: > > Buf : PAnsiChar; // contains the certificate and key. > Bio : PBio; > X : TX509Base; > > Bio := f_BIO_new_mem_buf(Buf, BufLen); > X.X509 := f_PEM_read_bio_X509(Bio, nil, nil, > PAnsiChar('password')); > f_BIO_Free(BIO); > if X.X509 = nil then > RaiseLastOpenSslError(Exception);
This example doesn't load the private key. Take a look at procedure TX509Base.LoadFromPemFile, you have to use just a different BIO as shown above. -- Arno Garrels -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be