How to use createPrivateKeyStore method of com.qaprosoft.carina.core.foundation.api.ssl.SSLContextBuilder class

Best Carina code snippet using com.qaprosoft.carina.core.foundation.api.ssl.SSLContextBuilder.createPrivateKeyStore

Source:SSLContextBuilder.java Github

copy

Full Screen

...103 KeyManagerFactory kmf = null;104 if (this.isClientAuthEnabled)105 {106 kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());107 kmf.init(createPrivateKeyStore(), readKeyStorePassword(tlsConfigDirectory));108 }109 // Get the client's trustStore for what server certificates the client will trust110 TrustManagerFactory trustFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());111 trustFactory.init(createTrustStore());112 // Create SSL context with the client's keyStore and trustStore113 SSLContext sslContext = SSLContext.getInstance("TLSv1.2");114 sslContext.init((this.isClientAuthEnabled) ? kmf.getKeyManagers() : null, trustFactory.getTrustManagers(), null);115 return sslContext;116 } catch (Exception e)117 {118 throw new RuntimeException(e);119 }120 }121 /**122 * Creates the client's trustStore; returns null if the tlsConfigDirectory was not found.123 * 124 * @return KeyStore125 */126 public KeyStore createTrustStore()127 {128 if (tlsConfigDirectory == null)129 {130 return null;131 } else132 {133 try134 {135 return readKeyStore(new File(tlsConfigDirectory, TRUSTSTORE_FILE), TRUSTSTORE_PASSWORD.toCharArray());136 } catch (Exception e)137 {138 throw new RuntimeException(e);139 }140 }141 }142 /**143 * Creates the client's keyStore with private and public keys; returns null if the tlsConfigDirectory was not found.144 * 145 * @return KeyStore146 */147 public KeyStore createPrivateKeyStore()148 {149 if (tlsConfigDirectory == null)150 {151 return null;152 } else153 {154 try155 {156 return readKeyStore(new File(tlsConfigDirectory, KEYSTORE_FILE), readKeyStorePassword(tlsConfigDirectory));157 } catch (Exception e)158 {159 throw new RuntimeException(e);160 }161 }...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Carina automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful