Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ The environment.json file contains information needed by the client SDK to acces
- certPath: file path to EJBCA client authentication certificate
- keyPath: file path to private key for EJBCA client authentication certificate
- ca: default CA to use for enrollment requests in highest-level scenarios wrapper
- profile: default end entity ptofile to use for enrollment requests in highest-level scenarios wrapper
- certificate_profile: default certificate profile to use for enrollment requests in highest-level scenarios wrapper
- end_entity_profile: default end entity profile to use for enrollment requests in highest-level scenarios wrapper


# Example usage:
Expand Down
3 changes: 2 additions & 1 deletion environment.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
"certPath":"/home/jdk/superadmin-ejdca.pem",
"keyPath":"/home/jdk/superadmin-ejdca.key",
"ca":"myCA",
"profile":"myProfile"
"certificate_profile":"myProfile",
"end_entity_profile":"myProfile"
}
6 changes: 3 additions & 3 deletions scenarios.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
import cryptoOps
import random

def addEndEntity(username,password,subject,ca,profile):
ejbcaclient.add({"username": username,"password": password,"subject_dn": subject,"ca_name": ca,"certificate_profile_name": "ENDUSER","end_entity_profile_name": profile,"token": "USERGENERATED","account_binding_id": "1234567890"})
def addEndEntity(username,password,subject,ca,certificate_profile,end_entity_profile):
ejbcaclient.add({"username": username,"password": password,"subject_dn": subject,"ca_name": ca,"certificate_profile_name": certificate_profile,"end_entity_profile_name": end_entity_profile,"token": "USERGENERATED","account_binding_id": "1234567890"})

def csrEnrollment(subject):
csr,key = cryptoOps.createCSR(subject)
username = f'python_client_{random.randrange(100000000,1000000000)}'
password = f'python_client_{random.randrange(100000000,1000000000)}_{random.randrange(100000000,1000000000)}'
addEndEntity(username,password,subject,ejbcaclient.config["ca"],ejbcaclient.config["profile"])
addEndEntity(username,password,subject,ejbcaclient.config["ca"],ejbcaclient.config["certificate_profile"],ejbcaclient.config["end_entity_profile"])
cert = ejbcaclient.certificate_request({"certificate_request":csr,"username":username,"password":password})
return cert["certificate"],key