Download Jar. Libraryless. Click here for Pure Java version (4871L/36K).
!7 !include once #1024321 // SNIKeyManager import javax.net.ssl.*; p { char[] passphrase = trim(loadSecretTextFileMandatory(#1013896, "keystore-pass")).toCharArray(); KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType()); temp InputStream keystoreStream = new FileInputStream(javaxSecretDir("keystore.p12")); keystore.load(keystoreStream, passphrase); KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); keyManagerFactory.init(keystore, passphrase); TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); trustManagerFactory.init(keystore); SSLContext ctx = SSLContext.getInstance("TLS"); KeyManager[] keyManagers = keyManagerFactory.getKeyManagers(); if (l(keyManagers) > 1) print("Confused: More than one key manager"); SNIKeyManager wrappedKeyManager = new((X509ExtendedKeyManager) first(keyManagers)); wrappedKeyManager.verbose = true; ctx.init(new KeyManager[] {wrappedKeyManager}, trustManagerFactory.getTrustManagers(), null); serveHttps(1443, ctx.getServerSocketFactory()); }
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1024323 |
Snippet name: | Serve HTTPS with SNI Spike 1 [doesn't work] |
Eternal ID of this version: | #1024323/7 |
Text MD5: | 66a66b982ab80571e908f51f524e8380 |
Transpilation MD5: | 935361de47e7ed816fcf542c7b94ee7d |
Author: | stefan |
Category: | javax / https |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-08-02 14:39:36 |
Source code size: | 1185 bytes / 27 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 267 / 961 |
Version history: | 6 change(s) |
Referenced in: | #1024325 - Serve HTTPS with SNI Spike 2 [WORKS!] |