Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OP-22232: Added support for secure redis connection #492

Merged
merged 4 commits into from
Nov 29, 2024

Conversation

utkarsh-opsmx
Copy link
Collaborator

No description provided.


System.out.println("Certificate has been added to the KeyStore successfully.");
} catch (Exception e) {
e.printStackTrace();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no point in proceeding with service initialization when an exception is caught, so please throw the exception appropriately.

keyStore.store(jksOutputStream, password);
jksOutputStream.close();

System.out.println("Certificate has been added to the KeyStore successfully.");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use log


FileOutputStream jksOutputStream = new FileOutputStream(jksFilePath);
keyStore.store(jksOutputStream, password);
jksOutputStream.close();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be in finally clause.

CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509");
FileInputStream certInputStream = new FileInputStream(certFilePath);
Certificate certificate = certificateFactory.generateCertificate(certInputStream);
certInputStream.close();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be in finally clause.

String alias = "redis-truststore"; // An alias to identify the certificate in the keystore
char[] password = this.password.toCharArray(); // Keystore password

try {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please write some comments clarifying the steps down below.

@rahul-chekuri rahul-chekuri merged commit 3ea1897 into v4.0 Nov 29, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants