blob: 42e0b7bd63c1c7477ae2e061ad8b9323177866d2 [file] [log] [blame]
elinuxhenrik02cb6012022-04-04 13:07:36 +02001The keystore.jks and truststore.jks files are created by using the following commands (note that this is an example):
2
31) Create a CA certificate and a private key:
4
5openssl genrsa -des3 -out CA-key.pem 2048
PatrikBuhrc863c9f2023-01-03 13:43:35 +01006openssl req -new -key CA-key.pem -x509 -days 3600 -out CA-cert.pem
elinuxhenrik02cb6012022-04-04 13:07:36 +02007
82) Create a keystore with a private key entry that is signed by the CA:
9
PatrikBuhrc863c9f2023-01-03 13:43:35 +010010Note: the "your name" must be "localhost" for the unittest to work.
11
elinuxhenrik02cb6012022-04-04 13:07:36 +020012keytool -genkeypair -alias policy_agent -keyalg RSA -keysize 2048 -keystore keystore.jks -validity 3650 -storepass policy_agent
13keytool -certreq -alias policy_agent -file request.csr -keystore keystore.jks -ext san=dns:your.domain.com -storepass policy_agent
PatrikBuhrc863c9f2023-01-03 13:43:35 +010014openssl x509 -req -days 3650 -in request.csr -CA CA-cert.pem -CAkey CA-key.pem -CAcreateserial -out ca_signed-cert.pem
elinuxhenrik02cb6012022-04-04 13:07:36 +020015keytool -importcert -alias ca_cert -file CA-cert.pem -keystore keystore.jks -trustcacerts -storepass policy_agent
16keytool -importcert -alias policy_agent -file ca_signed-cert.pem -keystore keystore.jks -trustcacerts -storepass policy_agent
17
18
193) Create a trust store containing the CA cert (to trust all certs signed by the CA):
20
21keytool -genkeypair -alias not_used -keyalg RSA -keysize 2048 -keystore truststore.jks -validity 3650 -storepass policy_agent
22keytool -importcert -alias ca_cert -file CA-cert.pem -keystore truststore.jks -trustcacerts -storepass policy_agent
23
24
254) Command for listing of the contents of jks files, examples:
26keytool -list -v -keystore keystore.jks -storepass policy_agent
27keytool -list -v -keystore truststore.jks -storepass policy_agent
28
29## License
30
31ONAP : ccsdk oran
32Copyright (C) 2020 Nordix Foundation. All rights reserved.
33Licensed under the Apache License, Version 2.0 (the "License");
34you may not use this file except in compliance with the License.
35You may obtain a copy of the License at
36
37 http://www.apache.org/licenses/LICENSE-2.0
38
39Unless required by applicable law or agreed to in writing, software
40distributed under the License is distributed on an "AS IS" BASIS,
41WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
42See the License for the specific language governing permissions and
43limitations under the License.
44