Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spki: streaming fingerprint builder #616

Merged
merged 1 commit into from
Apr 26, 2022
Merged

Conversation

tarcieri
Copy link
Member

Uses the Writer trait to compute SPKI fingerprints by hashing output DER on-the-fly as opposed to encoding it first to an intermediate buffer then computing the SHA-256 digest.

Besides simply being more efficient, the buffered method had a hardcoded limit of 4096-bytes. The new implementation has no such limit because it hashes data as soon as it's encoded.

This additionally renames SubjectPublicKeyInfo::fingerprint to ::fingerprint_bytes. "True" SPKI fingerprints are Base64-encoded, and this commit also promotes fingerprint_base64 to being earlier in the impl block so it's the first fingerprinting method people see.

Uses the `Writer` trait to compute SPKI fingerprints by hashing output
DER on-the-fly as opposed to encoding it first to an intermediate buffer
then computing the SHA-256 digest.

Besides simply being more efficient, the buffered method had a hardcoded
limit of 4096-bytes. The new implementation has no such limit because it
hashes data as soon as it's encoded.

This additionally renames `SubjectPublicKeyInfo::fingerprint` to
`::fingerprint_bytes`. "True" SPKI fingerprints are Base64-encoded, and
this commit also promotes `fingerprint_base64` to being earlier in the
impl block so it's the first fingerprinting method people see.
@tarcieri
Copy link
Member Author

It might be interesting to make fingerprint::Builder generic and integrate it directly into the der crate.

This works as a start, though.

@tarcieri tarcieri merged commit 73a4cde into master Apr 26, 2022
@tarcieri tarcieri deleted the spki/streaming-fingerprint branch April 26, 2022 00:15
@tarcieri tarcieri mentioned this pull request May 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant