Download Jar. Libraryless. Click here for Pure Java version (4950L/36K).
1 | !7 |
2 | |
3 | import javax.net.ssl.*; |
4 | |
5 | p { |
6 | char[] passphrase = trim(loadSecretTextFileMandatory(#1013896, "keystore-pass")).toCharArray(); |
7 | |
8 | KeyStore trustKeyStore = keyStoreFromFile(javaxSecretDir("keystore.p12"), passphrase); |
9 | KeyManager keyManager_botCompany = keyManagerFromKeyStore(javaxSecretDir("keystore.p12"), passphrase); |
10 | KeyManager keyManager_agiBlue = keyManagerFromKeyStore(javaxSecretDir("agi.blue/keystore.p12"), passphrase); |
11 | |
12 | SNIKeyManager wrappedKeyManager = new(litorderedmap( |
13 | "botcompany.de", pair(keyManager_botCompany, "botcompany"), |
14 | "agi.blue", pair(keyManager_agiBlue, "agi.blue")); |
15 | wrappedKeyManager.verbose = true; |
16 | |
17 | TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); |
18 | trustManagerFactory.init(trustKeyStore); |
19 | |
20 | SSLContext ctx = SSLContext.getInstance("TLS"); |
21 | ctx.init(new KeyManager[] {wrappedKeyManager}, trustManagerFactory.getTrustManagers(), null); |
22 | |
23 | serveHttps(1443, ctx.getServerSocketFactory()); |
24 | } |
25 | |
26 | html { |
27 | ret "It works!"; |
28 | } |
Began life as a copy of #1024323
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: | #1024325 |
Snippet name: | Serve HTTPS with SNI Spike 2 [WORKS!] |
Eternal ID of this version: | #1024325/8 |
Text MD5: | 6b63b3481c85356e882ff630742f6d36 |
Transpilation MD5: | 144ba1b78e619165c2f18c99425c3f17 |
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 15:18:51 |
Source code size: | 1073 bytes / 28 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 319 / 986 |
Version history: | 7 change(s) |
Referenced in: | [show references] |