Selfsigned cert apache localhost + netty ssl

Apr 27, 2018 16:45

Чтобы не потерять как это делается и не гуглить потом снова :)
================= generate_cert.bat ==============
set "apache=d:\www\Apache_2.4"
set "OPENSSL_CONF=%apache%\conf\openssl.cnf"
echo Obiazatelno tol'ko imya hosta (Common Name) i nachalniy parol', ostalnoe mojet bit' pustim.
%apache%\bin\openssl.exe req -new -out %1.csr -keyout %1.pem
%apache%\bin\openssl.exe rsa -in %1.pem -out %1.key
%apache%\bin\openssl.exe x509 -in %1.csr -out %1.cert -req -signkey %1.key -days 365

copy %1.cert "%apache%\conf\ssl"
copy %1.key "%apache%\conf\ssl"

%apache%\bin\openssl.exe pkcs8 -topk8 -nocrypt -in %1.key -out %1_pkcs8.pem
===================================================
> generate_cert.bat my_domain

Apache config: https://httpd.apache.org/docs/2.4/ssl/ssl_howto.html
Netty ssl key format: https://netty.io/wiki/sslcontextbuilder-and-private-key.html

sslCtx = SslContextBuilder.forServer(new File("d:/path/to/my_domain.cert"), new File("d:/path/to/my_domain_pkcs8.pem"),null).build();
...
pipeline.addLast(sslCtx.newHandler(ch.alloc())); // as first!

чтобы не потерять, редкое программерское

Previous post Next post
Up