Libraryless. Click here for Pure Java version (2863L/19K).
1 | import javax.net.*; |
2 | import javax.net.ssl.*; |
3 | |
4 | static SNIKeyManager serverSocketFactory_botCompanyPlusAgiBlue_keyManager; |
5 | |
6 | static SSLServerSocketFactory serverSocketFactory_botCompanyPlusAgiBlue() ctex { |
7 | char[] passphrase = trim(loadSecretTextFileMandatory(#1013896, "keystore-pass")).toCharArray(); |
8 | |
9 | KeyStore trustKeyStore = keyStoreFromFile(javaxSecretDir("keystore.p12"), passphrase); |
10 | KeyManager keyManager_botCompany = keyManagerFromKeyStore(javaxSecretDir("keystore.p12"), passphrase); |
11 | KeyManager keyManager_agiBlue = keyManagerFromKeyStore(javaxSecretDir("agi.blue/keystore.p12"), passphrase); |
12 | KeyManager keyManager_abotsSpace = keyManagerFromKeyStore(javaxSecretDir("abots.space/keystore.p12"), passphrase); |
13 | KeyManager keyManager_stefansOSSite = keyManagerFromKeyStore(javaxSecretDir("stefans-os.site/keystore.p12"), passphrase); |
14 | |
15 | SNIKeyManager wrappedKeyManager = new(litorderedmap( |
16 | "botcompany.de", pair(keyManager_botCompany, "botcompany.de"), |
17 | "agi.blue", pair(keyManager_agiBlue, "agi.blue"), |
18 | "abots.space", pair(keyManager_abotsSpace, "abots.space"), |
19 | "stefans-os.site", pair(keyManager_stefansOSSite, "stefans-os.site"), |
20 | "zttnn.me", pair(keyManagerFromKeyStore(javaxSecretDir("zttnn.me/keystore.p12"), passphrase), "zttnn.me"))); |
21 | serverSocketFactory_botCompanyPlusAgiBlue_keyManager = wrappedKeyManager; |
22 | |
23 | //wrappedKeyManager.verbose = true; |
24 | |
25 | TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); |
26 | trustManagerFactory.init(trustKeyStore); |
27 | |
28 | SSLContext ctx = SSLContext.getInstance("TLS"); |
29 | ctx.init(new KeyManager[] {wrappedKeyManager}, trustManagerFactory.getTrustManagers(), null); |
30 | |
31 | ret ctx.getServerSocketFactory(); |
32 | } |
33 | |
34 | html { |
35 | ret "It works!"; |
36 | } |
Began life as a copy of #1024325
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1024328 |
Snippet name: | serverSocketFactory_botCompanyPlusAgiBlue (etc.) |
Eternal ID of this version: | #1024328/11 |
Text MD5: | 13802c1a9663252ee93c8dfb1d4c29fd |
Transpilation MD5: | 600bd922695ea74c2fb13e2011e18540 |
Author: | stefan |
Category: | javax / https |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-05-07 02:06:23 |
Source code size: | 1808 bytes / 36 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 245 / 370 |
Version history: | 10 change(s) |
Referenced in: | [show references] |