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

feat(dpapi): implement MS-GKDI and DPAPI Blob encoding/decoding #348

Merged
merged 15 commits into from
Jan 16, 2025

Conversation

TheBestTvarynka
Copy link
Collaborator

Hi,
I implemented MS-GKDI structures and DPAPI Blob encoding/decoding in this PR.

Docs & references:

@TheBestTvarynka TheBestTvarynka self-assigned this Jan 15, 2025
@TheBestTvarynka TheBestTvarynka marked this pull request as ready for review January 15, 2025 12:51
Copy link
Member

@CBenoit CBenoit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work!

Remark on the Error type. It seems to me that the Error type is kind of becoming a big catch-all Error enum. It’s typically better to hand out more targeted errors to the users, so they can match on what matters for the domain. Had a similar discussion with Vlad recently: Devolutions/devolutions-gateway#1172 (comment)

Also saw this topic comes back in this blog post, as "umbrella errors": https://www.howtocodeit.com/articles/the-definitive-guide-to-rust-error-handling#umbrella-errors

Thanks to thiserror, it’s easier to create new smaller errors dedicated to the domain. Feel free to use it as much as needed.

crates/dpapi/src/error.rs Outdated Show resolved Hide resolved
crates/dpapi/src/error.rs Outdated Show resolved Hide resolved
crates/dpapi/src/error.rs Outdated Show resolved Hide resolved
crates/dpapi/src/sid_utils.rs Outdated Show resolved Hide resolved
crates/dpapi/src/utils.rs Outdated Show resolved Hide resolved
crates/dpapi/src/utils.rs Outdated Show resolved Hide resolved
crates/dpapi/src/utils.rs Outdated Show resolved Hide resolved
Copy link
Member

@CBenoit CBenoit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That’s solid work! LGTM!

@CBenoit CBenoit merged commit 2711686 into dev/dpapi Jan 16, 2025
41 checks passed
@CBenoit CBenoit deleted the feat/dpapi-gkdi-structures-dpapi-blob branch January 16, 2025 11:27

/// Decodes a UTF-16–encoded byte slice into a [String].
///
/// The input `data` slice should has the size multiple of two (`data.len() % 2 == 0`).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: should have

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants