@@ -23,7 +23,9 @@ def generate_ca_client_triplet(service_name: str) -> CAClientCertTriplet:
2323
2424 # Details about who we are. For a self-signed certificate, the subject
2525 # and issuer are always the same.
26- ca_subject = x509 .Name ([x509 .NameAttribute (NameOID .COMMON_NAME , f"ca.{ service_name } .user.centml.ai" )])
26+ ca_subject = x509 .Name (
27+ [x509 .NameAttribute (NameOID .COMMON_NAME , f"ca.{ service_name } .user.centml.ai" )]
28+ )
2729
2830 ca_certificate = (
2931 x509 .CertificateBuilder ()
@@ -44,7 +46,13 @@ def generate_ca_client_triplet(service_name: str) -> CAClientCertTriplet:
4446 client_private_key = ec .generate_private_key (ec .SECP384R1 ())
4547
4648 # Information about the client
47- client_subject = x509 .Name ([x509 .NameAttribute (NameOID .COMMON_NAME , f"client.{ service_name } .user.centml.ai" )])
49+ client_subject = x509 .Name (
50+ [
51+ x509 .NameAttribute (
52+ NameOID .COMMON_NAME , f"client.{ service_name } .user.centml.ai"
53+ )
54+ ]
55+ )
4856
4957 client_certificate = (
5058 x509 .CertificateBuilder ()
@@ -63,8 +71,12 @@ def generate_ca_client_triplet(service_name: str) -> CAClientCertTriplet:
6371 )
6472
6573 return CAClientCertTriplet (
66- certificate_authority = ca_certificate .public_bytes (serialization .Encoding .PEM ).decode ("ascii" ),
67- client_certificate = client_certificate .public_bytes (serialization .Encoding .PEM ).decode ("ascii" ),
74+ certificate_authority = ca_certificate .public_bytes (
75+ serialization .Encoding .PEM
76+ ).decode ("ascii" ),
77+ client_certificate = client_certificate .public_bytes (
78+ serialization .Encoding .PEM
79+ ).decode ("ascii" ),
6880 client_private_key = client_private_key .private_bytes (
6981 encoding = serialization .Encoding .PEM ,
7082 format = serialization .PrivateFormat .PKCS8 ,
@@ -85,9 +97,11 @@ def save_pem_file(service_name, client_private_key, client_certificate):
8597
8698 try :
8799 # Save the combined PEM file
88- with open (ca_file_path , 'w' ) as combined_pem_file :
100+ with open (ca_file_path , "w" ) as combined_pem_file :
89101 combined_pem_file .write (client_private_key + client_certificate )
90- click .echo (f"Combined PEM file for accessing the private endpoint has been saved to { ca_file_path } " )
102+ click .echo (
103+ f"Combined PEM file for accessing the private endpoint has been saved to { ca_file_path } "
104+ )
91105
92106 except Exception as e :
93107 click .echo (f"Error saving PEM files: { e } " )
0 commit comments