Skip to content

Commit 446cac3

Browse files
committed
feat: dirac-login try to load key without password
1 parent 106f600 commit 446cac3

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/DIRAC/FrameworkSystem/scripts/dirac_login.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -269,11 +269,12 @@ def loginWithCertificate(self):
269269

270270
chain = X509Chain()
271271
# Load user cert and key
272-
result = chain.loadChainFromFile(self.certLoc)
273-
if result["OK"]:
274-
result = chain.loadKeyFromFile(
275-
self.keyLoc, password=prompt("Enter Certificate password: ", is_password=True)
276-
)
272+
273+
if (result := chain.loadChainFromFile(self.certLoc))["OK"]:
274+
# We try to download the key first without a password
275+
if not (result := chain.loadKeyFromFile(self.keyLoc))["OK"]:
276+
password = prompt("Enter Certificate password: ", is_password=True)
277+
result = chain.loadKeyFromFile(self.keyLoc, password=password)
277278
if not result["OK"]:
278279
return result
279280

0 commit comments

Comments
 (0)