Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(221)

Unified Diff: net/data/ssl/scripts/crlsetutil.py

Issue 2382423002: minica.py: don't encode default critical=False values (Closed)
Patch Set: fix indent Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/data/ssl/certificates/ocsp-test-root.pem ('k') | net/tools/testserver/minica.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/data/ssl/scripts/crlsetutil.py
diff --git a/net/data/ssl/scripts/crlsetutil.py b/net/data/ssl/scripts/crlsetutil.py
index 49a1a860cdfaa81e83b4ffa4a5155cebfe46d08a..2fcad54c5a9fe5fd4d9e11fa3f7765434b9f8e9a 100755
--- a/net/data/ssl/scripts/crlsetutil.py
+++ b/net/data/ssl/scripts/crlsetutil.py
@@ -138,6 +138,18 @@ def _der_cert_to_spki(der_bytes):
return iterator.contents()
+def der_cert_to_spki_hash(der_cert):
+ """Gets the SHA-256 hash of the subjectPublicKeyInfo of a DER encoded cert
+
+ Args:
+ der_cert: A string containing the DER-encoded certificate
+
+ Returns:
+ The SHA-256 hash of the certificate, as a byte sequence
+ """
+ return hashlib.sha256(_der_cert_to_spki(der_cert)).digest()
+
+
def pem_cert_file_to_spki_hash(pem_filename):
"""Gets the SHA-256 hash of the subjectPublicKeyInfo of a cert in a file
@@ -147,8 +159,7 @@ def pem_cert_file_to_spki_hash(pem_filename):
Returns:
The SHA-256 hash of the first certificate in the file, as a byte sequence
"""
- return hashlib.sha256(
- _der_cert_to_spki(_pem_cert_to_binary(pem_filename))).digest()
+ return der_cert_to_spki_hash(_pem_cert_to_binary(pem_filename))
def main():
« no previous file with comments | « net/data/ssl/certificates/ocsp-test-root.pem ('k') | net/tools/testserver/minica.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698