Add a utility for creating CertificateFingerprints from a string.

Review Request #14888 — Created March 8, 2026 and updated

Information

Review Board
release-7.1.x

Reviewers

This introduces CertificateFingerprints.from_string(), which takes in
a string value, normalizes it, and attempts to determine if it
represents a SHA-1 or SHA-256 value. If it's either of these, an
instance of CertificateFingerprints will be created and returned with
the appropriate field filled out. Otherwise, None will be returned.

This is useful for cases where we're working with SCMs that provide a
single fingerprint that may be in either of these formats.

Unit tests pass.

Summary ID
Add a utility for creating CertificateFingerprints from a string.
This introduces `CertificateFingerprints.from_string()`, which takes in a string value, normalizes it, and attempts to determine if it represents a SHA-1 or SHA-256 value. If it's either of these, an instance of `CertificateFingerprints` will be created and returned with the appropriate field filled out. Otherwise, ``None`` will be returned. This is useful for cases where we're working with SCMs that provide a single fingerprint that may be in either of these formats.
98717d5a0fcf861bceddf9a37142c7335e3a23f7
Description From Last Updated

Do we want to validate that the string itself is in the correct format as well as the length? These …

daviddavid
Checks run (2 succeeded)
flake8 passed.
JSHint passed.
david
  1. 
      
  2. reviewboard/certs/cert.py (Diff revision 1)
     
     
     
     
     
    Show all issues

    Do we want to validate that the string itself is in the correct format as well as the length? These are pretty easy to validate via regex.

  3.