Technology Blog Posts by Members
cancel
Showing results for 
Search instead for 
Did you mean: 

Overview of SSL JAVA.

In SAP Java (SAP NetWeaver AS Java / SAP BTP Java applications), SSL (Secure Sockets Layer) refers to the use of SSL/TLS protocols to secure communication between SAP Java systems and other systems, browsers, web services, databases, or SAP components.

Purpose.
This blog describes the steps to configure SSL for the SAP NetWeaver AS Java.

Benefits of SSL for the SAP NetWeaver AS Java .

1. Secure User Authentication.
Encrypts user IDs and passwords during login.
Prevents attackers from capturing credentials over the network.
2. Server Authentication.
Uses digital certificates to verify that users are connecting to the legitimate SAP NetWeaver Java server.
Protects against spoofing and man-in-the-middle attacks.
3. Secure HTTPS Communication.
Enables secure access using HTTPS instead of HTTP.

Prerequisites for Configuring SSL in SAP NetWeaver Java.

1. SAP NetWeaver Java System Installed.
SAP NetWeaver AS Java must be up and running.
Access to the NetWeaver Administrator (NWA) is required.
2. SSL Server Certificate.
A valid server certificate and Intermediate CA certificate  and Root CA certificate is needed.
The certificate can be:
Issued by a trusted Certificate Authority (CA) such as DigiCert, GlobalSign, Sectigo, etc.
3. Trusted CA Certificates.
Root CA and Intermediate CA certificates must be imported.
4. HTTPS Port Configuration.
HTTPS Port must be enabled on the Java server.
The SSL port should be configured and open in the firewall.
5. DNS Name Matching.
The certificate Common Name (CN) or Subject Alternative Name (SAN) must match the server hostname.
Example:
Server URL: https://portal.company.com
Certificate CN: portal.company.com
6. Administrative Access.
You need access to:
NetWeaver Administrator (NWA)
Operating System (if certificate files need to be copied)
Security administration roles
7. Network
https port should be open from system and telnet should work with https port.

Team Requirement
1. Network Team will open https port.
2. Basis Team will do this SSL Configuration.
3. CA Team will sign this Certificate..

How to test SSL in JAVA working fine?
1. Access the Application Using HTTPS
Open a browser and access the Java application using HTTPS:
https://<hostname>:<https_port>

2. Test HTTPS Port Connectivity
1.From the OS level:
telnet <hostname> <HTTPs port>
2.Verify SSL Configuration in NWA
Navigate to:--NWA → Configuration → Security → Certificates and Keys
SSL Server Identity exists.
Certificate is valid.

We can configure SSL in JAVA NetWeaver with two methods.
1. From OS Level sapgenpse command.
2. From NWA Portal Certificates and Key : Key Storage

I will show you both methods.

1 First i will show you from OS Level sapgenpse command.

Step1 
I am going to configure SSL in JAVA.
Open NWA home page and navigate to Configuration--SSL

shalabhkumar_0-1787811384541.png

You will can below message showing. SSL port "54101": Not active

shalabhkumar_1-1787811456749.png

Step 2

Now Start the SSL Activity and make sure you take Complete Backup of System.
Take Backup of sec Dir.   /usr/sap/SID/J00

shalabhkumar_0-1787812115624.png

Step 3

Now go to /usr/sap/Q1A/J00/sec path and see structure of this path. Only 3 files is there.

shalabhkumar_1-1787812194515.png

Step 4

Now execute below commands
csh
setenv SECUDIR
setenv SECUDIR /usr/sap/SID/J00/sec

shalabhkumar_2-1787812268562.png

Step 5

Now Generate certificate with command below.
sapgenpse get_pse -p cert.pse -a sha256WithRsaEncryption -s 2048 -r csr.txt -k GN-dNSName:hostname with FQDN -k GN-dNSName:hostname with FQDN "CN=hostname with FQDN, OU=, O=, L=, C="

it will ask you to set the PIN. Remember this PIN because this PIN need to import Certificate later.
Hostname with FQDN
CN Common Name
OU Organizational Unit
O Organization
L Locality (City)
C Country

shalabhkumar_3-1787812364373.png

Step 6

Two file created csr.txt and cert.pse

shalabhkumar_4-1787812746204.png

Step 7

Now open csr.txt with more command.

shalabhkumar_5-1787812788873.png

Step 8

Now copy this Certificate and Sign from CA Authority or from SSO Server.
in my case i have SSO Server so i am signing this CSR from my SSO Server. You can Sign it from your Authorized CA. If you have SSO server below is steps for sign the certificate. 

Step 9

Open SSO Server.

shalabhkumar_6-1787812919366.png

Step 9.1

shalabhkumar_7-1787812950785.png

Paste here CSR certificate and Show Certificate Request. 

Step 9.2

shalabhkumar_8-1787812969939.png

Step 9.3

shalabhkumar_9-1787813033845.png

Then Click in Sign Certificate.

Step 9.4

shalabhkumar_10-1787813283596.png

Now we have sign certificates.

Step 10.

Now create one file SID.p7b  in /usr/sap/SID/J00/sec path with touch command SID.p7b

shalabhkumar_11-1787813341958.png

Step 11

Now open in vi mode and paste here that Server certificate which we signed from SSO and we need paste here root and intermediate certificate also. If you are signing this certificate from your CA you should have root intermediate  certificate also.
Total 3 Certificates need to paste here.   
First import Server Certificate 2nd Intermediate CA certificate 3rd Root CA certificate.

shalabhkumar_12-1787813437060.png

And save it from :wq! command

Step 12

Now Import the signed certificate.
sapgenpse import_own_cert -p cert.pse -c SID.p7b
It will prompt you to enter a PIN. Please provide the same PIN that you used while generating the certificate.

shalabhkumar_13-1787813483627.png

Step 13

Now run this command ---->  mv SAPSSLS.pse SAPSSLS.pse_orig

shalabhkumar_14-1787813558063.png

Step 14

Now Copy cert.pse to SAPSSLS.pse.-----> cp -r cert.pse SAPSSLS.pse

shalabhkumar_15-1787813781833.png

Step 15

Now run this command ---> sapgenpse seclogin -p /usr/sap/SID/J00/sec/SAPSSLS.pse -O sidadm
It will ask you Pin.  You need provide same Pin here which you given earlier.

shalabhkumar_16-1787813906520.png

Step 16

For PSE Status run this ---> sapgenpse get_my_name SAPSSLS.pse

shalabhkumar_17-1787813983227.png

Step 17

Now Generate private key pair & certificate:
sapgenpse export_p12 -p SAPSSLS.pse Q1A_SSL_PrivKey

shalabhkumar_18-1787814050287.png

Step 18

Now run this -> sapgenpse export_own_cert -p SAPSSLS.pse -o Q1A_SSL_cert.cert

shalabhkumar_20-1787814461544.png

Step 19

Take the Backup of Server Profile.
Now open DEFAULT.PFL Profile and change this parameter value service/protectedwebmethods = SDEFAULT –GetAccessPointList 

shalabhkumar_21-1787814492930.png

Step 20

Open the Instance Profile and make changes your parameter like below value.
icm/server_port_1 = PROT=HTTPS, PORT=50001, SSLCONFIG=ssl_config_1
icm/ssl_config_1 = VCLIENT=0, CRED=/usr/sap/Q1A/J00/sec/SAPSSLS.pse

shalabhkumar_0-1788413629030.png

Step 21

Take Service restart---> sapcontrol –nr 00 –function RestartService

shalabhkumar_23-1787814585319.png

Step 22

Now Copy this Q1A_SSL_PrivKey.p12 file and Q1A_SSL_cert.cer from OS to Local Desktop for import the certificate.

shalabhkumar_24-1787814663816.png

Import private key pairs to ICM via certificate & keys
it will ask to you Pin. You need to provide same Pin here.
Key imported here.

shalabhkumar_25-1787814712033.png

shalabhkumar_26-1787814775624.png

You can see Privkey imported.

Step 23shalabhkumar_27-1787814850716.png

Step 24

Now Take restart of System.

shalabhkumar_28-1787814899608.png

shalabhkumar_29-1787814926875.png

Step 25

You can monitor JAVA Staring Process.

shalabhkumar_30-1787814962171.png

Step 26

Now Launch NWA with https and 50001 port.
URL access from https and 5001 port.

shalabhkumar_31-1787815015361.png

shalabhkumar_32-1787815034375.png

SSL is completed with 1 Method.-------------------------------------------------------------------------------------------------------------------------------------

Now i will show Second Method.
Next, I will demonstrate the second method available on the NWA page under Certificates and Keys.
 
Step 1
Open NWA
Configuration
Certificates and Keys
ICM_SSL_instance ID. This instance you can check from instance Profile.
Click on Create tab.
shalabhkumar_1-1789032373670.pngStep 2

 

shalabhkumar_2-1789032665642.png

Step 3

shalabhkumar_1-1788414148406.png

Step 4

You need to fill below information 
Country Name
State Name
Organization name
Organization Unit
Common Name

shalabhkumar_6-1788415001183.png

Step 5

Now you need to give Email and DNS name.  
DNS name your FQDN need to provide.

shalabhkumar_5-1788414809422.png

Step 6

Hashing Algorithm Signature SHA-256
shalabhkumar_7-1788415111096.png
Click next it will give you summary and Finish.
You can see EPD coming now we are going to generate CSR request

shalabhkumar_8-1788415366830.png

Step 7

Download this file open in note pad and Send to CA for Sign.

shalabhkumar_9-1788415421193.png

Step 8

Once you received the Sign Certificate import from NWA. 
Configuration
Certificates and Keys
Select your ICM_SSL_Instance-ID
Import CSR response.

shalabhkumar_3-1788436397183.png

Step 8.1

shalabhkumar_0-1788435717308.png

Step 9

You need to change same parameter Value in DEFAULT and Instance Profile in this method also.
This will change in Instance Profile.
icm/server_port_2 = PROT=HTTPS, PORT=52001, SSLCONFIG=ssl_config_1
icm/ssl_config_1 = VCLIENT=0, CRED=/usr/sap/EPD/J20/sec/SAPSSLS.pse

shalabhkumar_2-1788436191701.png

shalabhkumar_1-1788436029732.png

Step 10

Take Application Restart.

shalabhkumar_4-1788436679079.png

 shalabhkumar_6-1788436747920.png

Step 11.

Now launch the URL with https://FQDN:port/nwa.   
It will open with https port.  
SSL is completed with 2 method.

*************************************************************************************************************************************************

************************Errors Encountered and Solutions Implemented During SSL Configuration*****************************

During the SSL configuration, I encountered some error messages. Let me share the solutions that helped resolve them.

Error 1
When i go to NWA--->Configuration--->SSL an found that SSL status is RED and Port not active.​<strong><br /><li-image width="999" height="999" alt="shalabhkumar_2-1788432688423.png" align="inline" id="455186iE609DEBBAF5970D4" size="large" resized="false" sourcetype="new"></li-image></strong>
 shalabhkumar_10-1788415715125.png
Solution-->2510099 - SSL Port XXXXX Not Active - message on NWA even though SSL works
I added below parameter  in instance profile and restart all instance and check again SSL Status is Green.
jstartup/service_acl = *

shalabhkumar_1-1788432521189.png

shalabhkumar_0-1788432445838.png

Error 2
I received the following error message during SSL certificate implementation.<li-image width="999" height="999" alt="shalabhkumar_11-1788415818150.png" align="inline" id="455046iD65E5715747235CC" size="large" resized="false" sourcetype="new"><li-code lang="abap">Solution --> I found below two notes and its is saying update your SPS till 26. In my case my SPS is 25 and this issue is fixed with SPS 26. So i am updating whole SPS from 25 to 36.
3243600 - Importing PKCS#12 certificate in NWA fails - ID21108: Invalid P
3382449 - Java.security.NoSuchAlgorithmException: Algorithm HmacPBESHA256 not available<li-code lang="abap">Error 3
I received the following error message during SSL certificate implementation from NWA.

shalabhkumar_13-1788416173968.png

Solution--> 1745538 - "Error: -> Certificate chain incomplete, no certificate found for issuer: " during import of CSR response
First import Server Certificate 2nd Intermediate CA certificate 3rd Root CA certificate and take Restart all instance.<li-code lang="abap">Error 4
Again i was facing issue while importing the Certificates getting below message.

shalabhkumar_14-1788416292327.png

Solution---> Solution 2338325 - No certificate matches the given private key
I Generate a new CSR Request and send to CA for Signing after Sign import again and my issue fixed.<li-code lang="abap">Error 5
In SSL Configuration below error messaging coming.

shalabhkumar_3-1788433157322.png

Solution
Solution 2291537 - use only one private key per keystore view<li-code lang="abap">We have two Private Key.  As per note need to delete one Private Key.  So i am deleting ssl-credentials  PRIVATE key.
Restart the server after deleted private key and this issue will be fixed.

 shalabhkumar_4-1788433241249.png

SSL configuration in SAP Java NetWeaver ensures secure communication between clients, web browsers, SAP systems, and external applications by encrypting data transmitted over the network.

Conclusion:
Java SSL in SAP NetWeaver is implemented to secure all network communications through encryption and certificate-based trust, protecting enterprise applications from eavesdropping, tampering, and impersonation attacks.

Labels in this area