// seems to assume same password is used for keystore as well as certificate. // if keystore file name ends with "12", it's assumed to be in PKCS12 format. static SSLServerSocketFactory makeSSLServerSocketFactory(File keystoreFile, S passphrase) ctex { KeyStore keystore = KeyStore.getInstance( endsWith(fileName(keystoreFile), "12") ? "PKCS12" : KeyStore.getDefaultType()); temp InputStream keystoreStream = new FileInputStream(keystoreFile); keystore.load(keystoreStream, passphrase.toCharArray()); TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); trustManagerFactory.init(keystore); KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); keyManagerFactory.init(keystore, passphrase.toCharArray()); SSLContext ctx = SSLContext.getInstance("TLS"); ctx.init(keyManagerFactory.getKeyManagers(), trustManagerFactory.getTrustManagers(), null); ret ctx.getServerSocketFactory(); }
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1018506 |
Snippet name: | makeSSLServerSocketFactory |
Eternal ID of this version: | #1018506/4 |
Text MD5: | 26cb86ac0b7681d262f8f1c9c7a13b2e |
Author: | stefan |
Category: | javax / https |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-12-31 17:37:01 |
Source code size: | 1047 bytes / 16 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 409 / 451 |
Version history: | 3 change(s) |
Referenced in: | [show references] |