SSL certificate, godaddy, JBoss AS 7 - ssl

[EDIT]
I used those two commands to generate the csr:
keytool -genkey -alias tomcat -keyalg RSA -keystore XY.key
keytool -certreq -keyalg RSA -alias tomcat -file certreq.csr -keystore XY.key
gd_bundle-g2-g1.crt has 3 blocks in it, the other two have only 1.
[/EDIT]
I want to install the certificates. I want to use:
keytool -import -alias [AB] -keystore [CD.key] -trustcacerts -file [EF.crt]
I know CD; that's the keystore I generated, but what alias (AB) is correct for which certificate (EF)? The three certificates I get are:
b715e55ecaeeba39.crt
gd_bundle-g2-g1.crt
gdig2.crt
And after I did that correctly, am I right by using the:
keytool -import -alias tomcat -keystore <your_keystore_filename> -file certreq.csr
The file with which I requested the Certificate?
Thank you for your help.

You can use any alias you want as long as you specify it in the server.xml file (parameter keyAlias, case sensitive).
tomcat seems to be the default alias : https://docs.jboss.org/jbossweb/7.0.x/ssl-howto.html

Related

Enabling-ssl-https for the keycloak-server

I am using keycloak-8.0.1 in standalone configuration . I am trying to enable SSL/Https for Keycloak server running on my Test machine (A.B.C.D) , token request will be requested from machine (X.Y.Z.P).
(Will there be any CORS/CSRF issue for the generated token , looks like yes ? And will Keycloak over SSL help to solve this?) Nevertheless i require SSL enabling .
So went ahead with https://www.keycloak.org/docs/latest/server_installation/#enabling-ssl-https-for-the-keycloak-server
Step 1 Run command :
keytool -genkey -alias localhost -keyalg RSA -keystore keycloak.jks -validity 10950
...
two files server.key and keycloak.jks got created.
Question : should i used localhost here or better to use IP A.B.C.D of my Test machine? Though documentation says localhost so went ahead with that.
Step 2 Generate a certificate request :
$ keytool -certreq -alias yourdomain -keystore keycloak.jks > keycloak.careq
I can also generate the cert request using localhost/A.B.C.D.
Step 3: Send the cert req created in above step to CA and download the root cert from CA(root.crt) and import using command:
keytool -import -keystore keycloak.jks -file root.crt -alias root
Do i have to skip this step for localhost and if not how to generate root.crt for localhost.
step 4: last step is to import CA generated certificate to keystore
$ keytool -import -alias yourdomain -keystore keycloak.jks -file your-certificate.cer
Question: Now i have only two files generated in very first step "server.key" and keycloak.jks
and from where i should get root.crt and your-certificate.cer ? I tried uploading the ca request to CAcert.org but they dont create certificate for localhost DNS.
I already went through lot of links link1 , link2 , link3 link4 and getting confused
Please help.
Answer 1-
If you are testing this in your local machine you can use localhost but better would be if you are using IP-address or host name
Answer 3
Again if its for your testing you can use Self Sign Certificate only,No need to go to Ads Certificate authority.
Answer 4-
So for localhost or your machine IP simple Create Certificate with the help of keytool
keytool -genkey -alias initcert -ext san=ip:xxx.xxx.xxx.xx -keyalg RSA -keystore keycloak.jks-validity 365 -keysize 2048
Export the certificates
keytool -export -noprompt -trustcacerts -keystore keycloak.jks -alias initcert -file keycloak.cer -storepass changeit
Import Certificates into Client machine Java Keystore
keytool -import -noprompt -trustcacerts -alias "initcert" -file keycloak.cer -keystore /workspace/tools/jdk/java-1.7.0-openjdk-1.7.0.25.x86_64/jre/lib/security/cacerts

How to generate trusted self signed certificate with SHA2 signing algorithm using keytool?

I am trying to establish a secure connection for my application using jetty http server version 8.1.8.v20121106 with self signed certificate.
I am generating self signed certificate with the following command,
keytool -genkey -alias mykey -keyalg RSA -keysize 2048 -sigalg SHA256withRSA -validity 365 -keypass password -keystore keystore.jks -storepass password
keytool -export -alias mykey -file server.cer -keystore keystore.jks -storepass password
keytool -import -alias mykey -file server.cer -keystore truststore.jks -storepass password
So, totally 3 files generate (keystore.jks,server.cer,truststore.jks)
After the server gets started, I got the following error in my browser. There are issues with the site's certificate chain (net::ERR_CERT_AUTHORITY_INVALID).
Could anyone help me to generate a trusted self signed certificate using keytool.
Thanks in advance.
It is the problem with java jdk. I have verified using java 1.8 and jdk1.7.0_79 it is working fyn for me. Change your java jdk version and verify. For further clarification, Please refer this link.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=398644

Convert Certificate to X.509

Good morning,
I recently requested a certificate from GoDaddy and they have sent me two sets of .pem and .spc files (SHA1 and SHA1) but when I try to import them to my codesignstore it says they are not X.509. Is there any way to convert them?
I used these commands to generate the files that I sent to GoDaddy.
Keystore
keytool -genkey -alias codesigncert -keyalg RSA -keysize 2048 -dname "CN=Corp,O=Corp,C=US,ST=FL,L=Orlando" -keystore codesignstore
Certificate Request
keytool -certreq -v -alias codesigncert -file codesign.pem -keystore codesignstore
Import
keytool –import –alias codesignecert –file NAME_OF_FILE_FROM_GODADDY –keystore codesignstore
I tried importing a trustcert using the below command and it worked for me.
keytool.exe -import -trustcacerts -alias "cert_alias_name" -file cert.pem -keystore "C:/Program Files/Java/jre1.8.0_291/lib/security/cacerts" -srcstorepass changeit -deststorepass changeit -v -noprompt
Certificate was added to keystore
[Storing C:/Program Files/Java/jre1.8.0_291/lib/security/cacerts]

QuickFIX initiator certificates are not required to establish SSL communication with the acceptor

I've been working on a client API using QuickFIX and I'm planning to use SSL and certificate based authentication. I generated self signed certificates for acceptor and initiator the following way:
1) Generate and export server/acceptor certificate:
keytool -genkeypair -keyalg RSA -keysize 2048 -alias server -keystore server.jks
keytool -export -alias server -file server.cer -keystore server.jks
2) Generate and export client/initiator certificate:
keytool -genkeypair -keyalg RSA -keysize 2048 -alias client -keystore client.jks
keytool -export -alias client -file client.cer -keystore client.jks
3) Import server/acceptor certificate to client keystore:
keytool -import -v -trustcacerts -alias server -file server.cer -keystore client.jks
4) Import client/initiator certificate to server/acceptor keystore:
keytool -import -v -trustcacerts -alias client -file client.cer -keystore server.jks
Acceptor config:
SocketUseSSL=Y
SocketKeyStore=server.jks
SocketKeyStorePassword=password
Initiator config:
SocketUseSSL=Y
SocketKeyStore=client.jks
SocketKeyStorePassword=password
Everything seems to work fine and data is getting encrypted. However, if I remove the initiator's client.jks keystore file, I will get a QuickFIX log entry saying "client.jks: keystore not found, using empty keystore". Strange thing, the initiator is still able to connect and establish a valid FIX session. I would expected the connection to be dropped immediately since no valid certificate is provided. Am I missing something?
The client certificate is not required by default, you must set this:
NeedClientAuth=Y

ssl weblogic with identity keystore

I can't make my weblogic 11g to work on https. The problem is with identity keystore. How should I create identity keystore? I have private key, web server certificate and intermediate certificate in pem format. I import private key and certificates like this:
keytool -import -keystore myIdentity.jks -storepass mypass -storetype JKS -alias myPrivateKey -file mykey.pem -keypass mypass
keytool -import -keystore myIdentity.jks -storepass mypass -storetype JKS -alias mycert -trustcacerts -file certificate.pem -keypass mypass
I am dummy at this and don't know what is wrong
Generate the IdentityStore :
keytool -genkey -keystore myIdentityStore.jks -storepass welcome1 -alias dummy -dname CN="dummy,C=FR" -keypass welcome1
Import certificates in the TrustStore
keytool -import -v -noprompt -trustcacerts -alias myCertificateAliasName -file myCertificateLocation -keystore myTrustStore.jks -storepass welcome1
Configure your weblogic Server :
Environment -> Servers – AdminServer -> Keystores, then
Change Demo Identity and Demo Trust to Custom Identity and Custom Trust.
Also, change those values for Identity
Custom Identity Keystore : $OSB_HOME/vesiKeyStore/vesiIdentityStore.jks,
Custom Identity Keystore Type : JKS,
Confirm Custom Identity Keystore Passphrase :welcome1.
Do the same for Trust.
restart the server.
Found very useful:
This link
I generated keystore with IBM Keyman and solved my problems.