Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

32
LINES

< > BotCompany Repo | #1028044 // serverSocketFactory_botCompanyPlusAgiBlue backup

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2858L/19K).

import javax.net.*;
import javax.net.ssl.*;

static SNIKeyManager serverSocketFactory_botCompanyPlusAgiBlue_keyManager;

static SSLServerSocketFactory serverSocketFactory_botCompanyPlusAgiBlue() ctex {
  char[] passphrase = trim(loadSecretTextFileMandatory(#1013896, "keystore-pass")).toCharArray();

  KeyStore trustKeyStore = keyStoreFromFile(javaxSecretDir("keystore.p12"), passphrase);
  KeyManager keyManager_botCompany = keyManagerFromKeyStore(javaxSecretDir("keystore.p12"), passphrase);
  KeyManager keyManager_agiBlue = keyManagerFromKeyStore(javaxSecretDir("agi.blue/keystore.p12"), passphrase);
  KeyManager keyManager_abotsSpace = keyManagerFromKeyStore(javaxSecretDir("abots.space/keystore.p12"), passphrase);
  KeyManager keyManager_stefansOSSite = keyManagerFromKeyStore(javaxSecretDir("stefans-os.site/keystore.p12"), passphrase);

  SNIKeyManager wrappedKeyManager = new(litorderedmap(
    "botcompany.de", pair(keyManager_botCompany, "botcompany.de"),
    "agi.blue", pair(keyManager_agiBlue, "agi.blue"),
    "abots.space", pair(keyManager_abotsSpace, "abots.space"),
    "stefans-os.site", pair(keyManager_stefansOSSite, "stefans-os.site"),
    "zttnn.me", pair(keyManagerFromKeyStore(javaxSecretDir("zttnn.me/keystore.p12"), passphrase), "zttnn.me")));
  serverSocketFactory_botCompanyPlusAgiBlue_keyManager = wrappedKeyManager;

  //wrappedKeyManager.verbose = true;
    
  TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
  trustManagerFactory.init(trustKeyStore);

  SSLContext ctx = SSLContext.getInstance("TLS");
  ctx.init(new KeyManager[] {wrappedKeyManager}, trustManagerFactory.getTrustManagers(), null);
  
  ret ctx.getServerSocketFactory();
}

Author comment

Began life as a copy of #1024328

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: #1028044
Snippet name: serverSocketFactory_botCompanyPlusAgiBlue backup
Eternal ID of this version: #1028044/1
Text MD5: 1a4c8af167527224dee419304b865394
Transpilation MD5: f93ef6c92e0e96bd20da32e5a3e98aec
Author: stefan
Category: javax / https
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-05-08 10:24:09
Source code size: 1775 bytes / 32 lines
Pitched / IR pitched: No / No
Views / Downloads: 190 / 270
Referenced in: [show references]