Skip to content

Commit

Permalink
Merge pull request #19127 from Thisara-Welmilla/change-to-pkcs-keysto…
Browse files Browse the repository at this point in the history
…re-type

Change default keystore type to PKCS12.
  • Loading branch information
Thisara-Welmilla authored Jan 25, 2024
2 parents 19181a9 + 8fd6094 commit b080f1c
Show file tree
Hide file tree
Showing 121 changed files with 375 additions and 312 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
disableUploadTimeout="false"
secure="true"
keystorePass="wso2carbon"
keystoreFile="${carbon.home}/repository/resources/security/wso2carbon.jks"
keystoreFile="${carbon.home}/repository/resources/security/wso2carbon.p12"
maxThreads="250"
acceptCount="200"
bindOnInit="false"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
},
"user_store.type": "database_unique_id",

"keystore.primary.type" : "JKS",
"keystore.primary.type" : "PKCS12",
"keystore.userstore_password_encryption": "",
"truststore.type" : "JKS",
"truststore.type" : "PKCS12",

"transport.https.sslHostConfig.properties.certificateVerification": "want",

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ username = "wso2carbon"
password = "wso2carbon"

[keystore.primary]
file_name = "wso2carbon.jks"
file_name = "wso2carbon.p12"
password = "wso2carbon"

[truststore]
file_name="client-truststore.jks"
file_name="client-truststore.p12"
password="wso2carbon"
type="JKS"
type="PKCS12"

[account_recovery.endpoint.auth]
hash= "66cd9688a2ae068244ea01e70f0e230f5623b7fa4cdecb65070a09ec06452262"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@
#
##KeyStores configurations
#
#keystore.identity.location=repository/resources/security/wso2carbon.jks
#keystore.identity.type=JKS
#keystore.identity.location=repository/resources/security/wso2carbon.p12
#keystore.identity.type=PKCS12
#keystore.identity.alias=wso2carbon
#keystore.identity.store.password=wso2carbon
##keystore.identity.store.secretProvider=<any implementation of org.apache.synapse.commons.security.secret.SecretCallbackHandler>
#keystore.identity.key.password=wso2carbon
##keystore.identity.key.secretProvider=<any implementation of org.apache.synapse.commons.security.secret.SecretCallbackHandler>
##keystore.identity.parameters=enableHostnameVerifier=false;keyStoreCertificateFilePath=/home/esb.cer
#
#keystore.trust.location=repository/resources/security/client-truststore.jks
#keystore.trust.type=JKS
#keystore.trust.location=repository/resources/security/client-truststore.p12
#keystore.trust.type=PKCS12
#keystore.trust.alias=wso2carbon
#keystore.trust.store.password=wso2carbon
##keystore.trust.store.secretProvider=<any implementation of org.apache.synapse.commons.security.secret.SecretCallbackHandler>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"SAML.IdPCertAlias" : "wso2carbon",
"SAML.PrivateKeyAlias": "wso2carbon",
"SAML.PrivateKeyPassword" : "wso2carbon",
"SAML.KeyStore" : "{carbon.home}/repository/resources/security/wso2carbon.jks"
"SAML.KeyStore" : "{carbon.home}/repository/resources/security/wso2carbon.p12"

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,10 @@ protected File getDeploymentTomlFile(String carbonHome) {
public void setSystemproperties() {

System.setProperty("javax.net.ssl.trustStore", FrameworkPathUtil.getSystemResourceLocation() + File.separator +
"keystores" + File.separator + "products" + File.separator + "wso2carbon.jks");
"keystores" + File.separator + "products" + File.separator + "wso2carbon.p12");
System.setProperty("javax.net.ssl.trustStorePassword",
"wso2carbon");
System.setProperty("javax.net.ssl.trustStoreType", "JKS");
System.setProperty("javax.net.ssl.trustStoreType", "PKCS12");
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@
-->
<keystore name="wso2">
<!-- Keystore file location -->
<fileName>keystores/products/wso2carbon.jks</fileName>
<!-- Keystore type (JKS/PKCS12 etc.) -->
<type>JKS</type>
<fileName>keystores/products/wso2carbon.p12</fileName>
<!-- Keystore type (PKCS12/PKCS12 etc.) -->
<type>PKCS12</type>
<!-- Keystore password -->
<password>wso2carbon</password>
<!-- Private Key alias -->
Expand All @@ -98,9 +98,9 @@
-->
<truststore name="wso2">
<!-- trust-store file location -->
<fileName>client-truststore.jks</fileName>
<!-- trust-store type (JKS/PKCS12 etc.) -->
<type>JKS</type>
<fileName>client-truststore.p12</fileName>
<!-- trust-store type (PKCS12/PKCS12 etc.) -->
<type>PKCS12</type>
<!-- trust-store password -->
<password>wso2carbon</password>
</truststore>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
</xs:element>
<xs:element type="xs:string" name="type">
<xs:annotation>
<xs:documentation>Keystore type (JKS/PKCS12 etc.)
<xs:documentation>Keystore type (PKCS12/PKCS12 etc.)
</xs:documentation>
</xs:annotation>
</xs:element>
Expand Down Expand Up @@ -181,7 +181,7 @@
</xs:element>
<xs:element type="xs:string" name="type">
<xs:annotation>
<xs:documentation>trust-store type (JKS/PKCS12
<xs:documentation>trust-store type (PKCS12/PKCS12
etc.)
</xs:documentation>
</xs:annotation>
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 2 additions & 2 deletions modules/integration/tests-integration/tests-backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>${basedir}/target/tobeCopied/</outputDirectory>
<includes>**/*.jks,**/*.mar,**/axis2_client.xml</includes>
<includes>**/*.jks,**/*.p12,**/*.mar,**/axis2_client.xml</includes>
</artifactItem>
</artifactItems>
</configuration>
Expand Down Expand Up @@ -558,7 +558,7 @@
${basedir}/target/tobeCopied/wso2is-${project.version}/repository/resources/security/
</directory>
<includes>
<include>**/*.jks</include>
<include>**/*.jks,**/*.p12</include>
</includes>
</resource>
</resources>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ public class KeyStoreUtil {

public static void setTrustStoreParams() {
String trustStore = filePath.getAbsolutePath();
System.setProperty("javax.net.ssl.trustStore", trustStore + "/client-truststore.jks");
System.setProperty("javax.net.ssl.trustStore", trustStore + "/client-truststore.p12");
System.setProperty("javax.net.ssl.trustStorePassword", "wso2carbon");

}

public static void setKeyStoreParams() {
String keyStore = filePath.getAbsolutePath();
System.setProperty("Security.KeyStore.Location", keyStore + "/wso2carbon.jks");
System.setProperty("Security.KeyStore.Location", keyStore + "/wso2carbon.p12");
System.setProperty("Security.KeyStore.Password", "wso2carbon");

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,9 +441,9 @@ private String getLocationHeaderValue(HttpResponse response) {
*/
private void initServiceProviderKeys() throws Exception {

KeyStore keyStore = KeyStore.getInstance("JKS");
KeyStore keyStore = KeyStore.getInstance("PKCS12");
String jksPath = TestConfigurationProvider.getResourceLocation("IS") + File.separator + "sp" +
File.separator + "keystores" + File.separator + "sp1KeyStore.jks";
File.separator + "keystores" + File.separator + "sp1KeyStore.p12";
String jksPassword = "wso2carbon";

keyStore.load(Files.newInputStream(Paths.get(jksPath)), jksPassword.toCharArray());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,9 @@ private String buildSignedJWT(String consumerKey, RSAPrivateKey privateKey) thro

private void initServiceProviderKeys() throws Exception {

KeyStore keyStore = KeyStore.getInstance("JKS");
KeyStore keyStore = KeyStore.getInstance("PKCS12");
String jksPath = TestConfigurationProvider.getResourceLocation("IS") + File.separator + "sp" +
File.separator + "keystores" + File.separator + "sp1KeyStore.jks";
File.separator + "keystores" + File.separator + "sp1KeyStore.p12";
String jksPassword = "wso2carbon";

keyStore.load(Files.newInputStream(Paths.get(jksPath)), jksPassword.toCharArray());
Expand All @@ -297,7 +297,7 @@ private void initServiceProviderKeys() throws Exception {

// Use another keystore to get sp2 private key.
jksPath = TestConfigurationProvider.getResourceLocation("IS") + File.separator + "sp" +
File.separator + "keystores" + File.separator + "sp2KeyStore.jks";
File.separator + "keystores" + File.separator + "sp2KeyStore.p12";

keyStore.load(Files.newInputStream(Paths.get(jksPath)), jksPassword.toCharArray());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,9 @@ private String getLocationHeaderValue(HttpResponse response) {

private void initServiceProviderKeys() throws Exception {

KeyStore keyStore = KeyStore.getInstance("JKS");
KeyStore keyStore = KeyStore.getInstance("PKCS12");
String jksPath = TestConfigurationProvider.getResourceLocation("IS") + File.separator + "sp" +
File.separator + "keystores" + File.separator + "sp1KeyStore.jks";
File.separator + "keystores" + File.separator + "sp1KeyStore.p12";
String jksPassword = "wso2carbon";

keyStore.load(new FileInputStream(jksPath), jksPassword.toCharArray());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,10 @@ private void createApplication() throws Exception {
private void setSystemProperties() {

URL resourceUrl = getClass().getResource(ISIntegrationTest.URL_SEPARATOR + "keystores" + ISIntegrationTest.URL_SEPARATOR
+ "products" + ISIntegrationTest.URL_SEPARATOR + "wso2carbon.jks");
+ "products" + ISIntegrationTest.URL_SEPARATOR + "wso2carbon.p12");
System.setProperty(JAVAX_NET_SSL_TRUSTORE, resourceUrl.getPath());
System.setProperty(JAVAX_NET_SSL_TRUSTORE_PASSWORD, "wso2carbon");
System.setProperty(JAVAX_NET_SSL_TRUSTORE_TYPE, "JKS");
System.setProperty(JAVAX_NET_SSL_TRUSTORE_TYPE, "PKCS12");
}

private HttpResponse sendSAMLMessage(String url, Map<String, String> parameters) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ public void testSAMLAssertionIDRequest() {
log.info("RESPONSE " + this.samlResponse);
String id = QueryClientUtils.getAssertionId(this.samlResponse);
URL resourceUrl = getClass().getResource(ISIntegrationTest.URL_SEPARATOR + "keystores" + ISIntegrationTest.URL_SEPARATOR
+ "products" + ISIntegrationTest.URL_SEPARATOR + "wso2carbon.jks");
+ "products" + ISIntegrationTest.URL_SEPARATOR + "wso2carbon.p12");
ClientSignKeyDataHolder signKeyDataHolder = null;
try {
signKeyDataHolder = new ClientSignKeyDataHolder(resourceUrl.getPath(),
Expand All @@ -279,7 +279,7 @@ public void testSAMLAttributeQueryRequest() {

try {
URL resourceUrl = getClass().getResource(ISIntegrationTest.URL_SEPARATOR + "keystores" + ISIntegrationTest.URL_SEPARATOR
+ "products" + ISIntegrationTest.URL_SEPARATOR + "wso2carbon.jks");
+ "products" + ISIntegrationTest.URL_SEPARATOR + "wso2carbon.p12");
ClientSignKeyDataHolder signKeyDataHolder = new ClientSignKeyDataHolder(resourceUrl.getPath(),
"wso2carbon", "wso2carbon");
String serverURL = TestUserMode.TENANT_ADMIN.equals(config.getUserMode()) ? WSO2IS_TENANT_URL : WSO2IS_URL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void addSPMetadataForTenant() throws Exception {
KeyStoreData[] keyStoreDataArray = keyStoreAdminClient.getKeyStores();
Assert.assertTrue(keyStoreDataArray != null && keyStoreDataArray.length > 0);

String [] storeEntries = keyStoreAdminClient.getStoreEntries("wso2-com.jks");
String [] storeEntries = keyStoreAdminClient.getStoreEntries("wso2-com.p12");
Assert.assertTrue(storeEntries != null && storeEntries.length > 0);
Assert.assertTrue(Arrays.asList(storeEntries).contains(CERT_ALIAS));
}
Expand All @@ -104,7 +104,7 @@ public void restartTestServer() throws Exception {
KeyStoreData[] keyStoreDataArray = keyStoreAdminClient.getKeyStores();
Assert.assertTrue(keyStoreDataArray != null && keyStoreDataArray.length > 0);

String [] storeEntries = keyStoreAdminClient.getStoreEntries("wso2-com.jks");
String [] storeEntries = keyStoreAdminClient.getStoreEntries("wso2-com.p12");
Assert.assertTrue(storeEntries != null && storeEntries.length > 0);
Assert.assertTrue(Arrays.asList(storeEntries).contains(CERT_ALIAS));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void testInit() throws Exception {
super.init();
scm = new ServerConfigurationManager(isServer);
sasc = new SecurityAdminServiceClient(backendURL, sessionCookie);
String KeyStoreName = "wso2carbon.jks";
String KeyStoreName = "wso2carbon.p12";
SecurityAdminServiceClient securityAdminServiceClient = new SecurityAdminServiceClient(
backendURL, sessionCookie);
securityAdminServiceClient.applySecurity("wso2carbon-sts", "1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -419,11 +419,11 @@ public void testSendLogoutRequestEmptyWtrealm() throws Exception {

private void setSystemProperties() {
URL resourceUrl = getClass().getResource(ISIntegrationTest.URL_SEPARATOR + "keystores" + ISIntegrationTest.URL_SEPARATOR
+ "products" + ISIntegrationTest.URL_SEPARATOR + "wso2carbon.jks");
+ "products" + ISIntegrationTest.URL_SEPARATOR + "wso2carbon.p12");
System.setProperty("javax.net.ssl.trustStore", resourceUrl.getPath());
System.setProperty("javax.net.ssl.trustStorePassword",
"wso2carbon");
System.setProperty("javax.net.ssl.trustStoreType", "JKS");
System.setProperty("javax.net.ssl.trustStoreType", "PKCS12");
}

private ClaimMapping[] getClaimMappings() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public void testInit() throws Exception {
serverConfigurationManager = new ServerConfigurationManager(isServer);
keyStoreFilePath =
getTestArtifactLocation() + File.separator + "keystores" + File.separator + "products" + File.separator
+ "wso2carbon.jks";
+ "wso2carbon.p12";
userstoreDeploymentDir = Utils.getResidentCarbonHome() + File.separator + "repository" + File.separator +
"deployment" + File.separator + "server" + File.separator + "userstores";
}
Expand Down Expand Up @@ -183,7 +183,7 @@ private KeyStore getKeyStore(String keyStoreFilePath, String password, String ke
InputStream inputStream = null;
try {
inputStream = new FileInputStream(new File(keyStoreFilePath).getAbsolutePath());
store = KeyStore.getInstance("JKS");
store = KeyStore.getInstance("PKCS12");
store.load(inputStream, password.toCharArray());
return store;
} catch (FileNotFoundException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ public static Tomcat getTomcat(Class testClass) {
public static void setSystemProperties(Class classIn) {

System.setProperty("javax.net.ssl.trustStore", FrameworkPathUtil.getSystemResourceLocation() + File.separator +
"keystores" + File.separator + "products" + File.separator + "wso2carbon.jks");
"keystores" + File.separator + "products" + File.separator + "wso2carbon.p12");
System.setProperty("javax.net.ssl.trustStorePassword", "wso2carbon");
System.setProperty("javax.net.ssl.trustStoreType", "JKS");
System.setProperty("javax.net.ssl.trustStoreType", "PKCS12");
}

public static HttpResponse sendPOSTMessage(String sessionKey, String url, String userAgent, String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ username = "$env{SHARED_DATABASE_USERNAME}"
password = "$env{SHARED_DATABASE_PASSWORD}"

[keystore.primary]
file_name = "wso2carbon.jks"
file_name = "wso2carbon.p12"
password = "wso2carbon"

[event.default_listener.governance_identity_mgt]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ username = "$env{SHARED_DATABASE_USERNAME}"
password = "$env{SHARED_DATABASE_PASSWORD}"

[keystore.primary]
file_name = "wso2carbon.jks"
file_name = "wso2carbon.p12"
password = "wso2carbon"

[identity_mgt.analytics_login_data_publisher]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ username = "$env{SHARED_DATABASE_USERNAME}"
password = "$env{SHARED_DATABASE_PASSWORD}"

[keystore.primary]
file_name = "wso2carbon.jks"
file_name = "wso2carbon.p12"
password = "wso2carbon"

[truststore]
file_name="client-truststore.jks"
file_name="client-truststore.p12"
password="wso2carbon"
type="JKS"
type="PKCS12"

[account_recovery.endpoint.auth]
hash= "66cd9688a2ae068244ea01e70f0e230f5623b7fa4cdecb65070a09ec06452262"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ username = "$env{SHARED_DATABASE_USERNAME}"
password = "$env{SHARED_DATABASE_PASSWORD}"

[keystore.primary]
file_name = "wso2carbon.jks"
file_name = "wso2carbon.p12"
password = "wso2carbon"

[truststore]
file_name="client-truststore.jks"
file_name="client-truststore.p12"
password="wso2carbon"
type="JKS"
type="PKCS12"

[account_recovery.endpoint.auth]
hash= "66cd9688a2ae068244ea01e70f0e230f5623b7fa4cdecb65070a09ec06452262"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@
<ReceivePort>${Ports.ThriftEntitlementReceivePort}</ReceivePort>
<ClientTimeout>10000</ClientTimeout>
<KeyStore>
<Location>${carbon.home}/repository/resources/security/wso2carbon.jks</Location>
<Location>${carbon.home}/repository/resources/security/wso2carbon.p12</Location>
<Password>wso2carbon</Password>
</KeyStore>
<!-- Enable this element to mention the host-name of your IS machine -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ username = "$env{SHARED_DATABASE_USERNAME}"
password = "$env{SHARED_DATABASE_PASSWORD}"

[keystore.primary]
name = "wso2carbon.jks"
name = "wso2carbon.p12"
password = "wso2carbon"

[authentication.authenticator.email_otp.parameters]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@
<ReceivePort>${Ports.ThriftEntitlementReceivePort}</ReceivePort>
<ClientTimeout>10000</ClientTimeout>
<KeyStore>
<Location>${carbon.home}/repository/resources/security/wso2carbon.jks</Location>
<Location>${carbon.home}/repository/resources/security/wso2carbon.p12</Location>
<Password>wso2carbon</Password>
</KeyStore>
<!-- Enable this element to mention the host-name of your IS machine -->
Expand Down
Loading

0 comments on commit b080f1c

Please sign in to comment.