You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def _has_root_cert(self):
if sys.platform == "darwin":
name = self.ca_cert_file_path
else:
name = "{server} Root CA".format(server=self.server)
print("Vaild cert? ")
print(self.check_valid_cert(name, usage="CT,T,T", is_root=True))
if self.check_valid_cert(name, usage="CT,T,T", is_root=True):
print("Yes? True.")
return True
print("No? False.")
return False
result:
> mtls -s some-prod certificate create
Retrieving CRL from server...
Writing CRL to /home/dpc/.config/mtls/some-prod/crl.pem
Vaild cert?
(False, False, False)
Yes? True.
Decrypting User Key...
Generating CSR for bitgo-prod
Signing CSR for verification on server...
CSR Public key does not match previous user key
AFAICT a tuple of three False values becomes True, which is :sus:.
That's because Python's __bool__ implementation only checks if len(x) != 0. This can be fixed if any/all are used instead, depending on the use case. In this case I think any(self.check_valid_cert(name, usage="CT,T,T", is_root=True)) would work
Activity
nocturn9x commentedon Mar 25, 2023
That's because Python's
__bool__implementation only checks iflen(x) != 0. This can be fixed ifany/allare used instead, depending on the use case. In this case I thinkany(self.check_valid_cert(name, usage="CT,T,T", is_root=True))would work