-
Notifications
You must be signed in to change notification settings - Fork 42
Dapr crypto scheme v1 (high level methods) #42
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
Conversation
Codecov Report
@@ Coverage Diff @@
## main #42 +/- ##
==========================================
+ Coverage 79.07% 80.60% +1.52%
==========================================
Files 26 31 +5
Lines 1491 1856 +365
==========================================
+ Hits 1179 1496 +317
- Misses 233 259 +26
- Partials 79 101 +22
... and 1 file with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
1a49ff9 to
70ad786
Compare
Signed-off-by: ItalyPaleAle <[email protected]>
Signed-off-by: ItalyPaleAle <[email protected]>
70ad786 to
021cf6c
Compare
Signed-off-by: Alessandro (Ale) Segala <[email protected]>
Signed-off-by: ItalyPaleAle <[email protected]>
Signed-off-by: ItalyPaleAle <[email protected]>
Signed-off-by: ItalyPaleAle <[email protected]>
Signed-off-by: ItalyPaleAle <[email protected]>
Signed-off-by: ItalyPaleAle <[email protected]>
Co-authored-by: Tiago Alves Macambira <[email protected]> Signed-off-by: Alessandro (Ale) Segala <[email protected]>
|
@ItalyPaleAle there seems to be a flaky test in here. Can you take a look? |
|
@mukundansundar looks like there was a bug in the crypto code but not in what was added with this PR. Fixed here: #44 |
Signed-off-by: ItalyPaleAle <[email protected]>
cbcf722 to
3629d26
Compare
Signed-off-by: ItalyPaleAle <[email protected]>
…le/dapr-kit into dapr-crypto-scheme-v1
Signed-off-by: ItalyPaleAle <[email protected]>
|
@ItalyPaleAle not completely finished the code part of the review, but thought it was worth sending my comments/questions about the design early 🙂 |
Signed-off-by: ItalyPaleAle <[email protected]>
|
Thanks @JoshVanL I have addressed your comments and made (almost all) the suggested changes so far. |
|
I recommend not marking comments as resolved unless the reviewer agrees or is unresponsive. |
Signed-off-by: ItalyPaleAle <[email protected]>
Description
This PR implements the Dapr crypto scheme v1, as defined in dapr/proposals#3
It includes the methods
EncryptandDecryptwhich are high-level methods to encrypt and decrypt messages of arbitrary length (up to 256TB). These methods work on streams and don't hold more than 64KB of data in a buffer.This PR includes extensive unit tests that cover all edge cases.
Example usage
To encrypt a message, you invoke the
Encryptmethod with a readable stream containing the plaintext data and an object containing options.The most important option is
WrapKeyFn, which is a function that, given a plaintext file key (randomly-generated by theEncryptmethod), the name of a key in the vault, and the algorithm, returns the wrapped key. Callers are required to pass this method as a lambda, which will perform wrapping using a component (for example, Azure Key Vault).The method returns a readable stream
encwhich will have the data written to it.The method does not accept a context because it is not needed when working with streams. Callers can stop the method by stopping the input stream. The
WrapKeyFnshould manage its context (for the network call) internally (i.e. inside the lambda).The signature of the
Decryptmethod is similar, except it takes less options, with the only required one being anUnwrapKeyFn(same concept as key wrapping forEncrypt):Here too,
encis a readable stream to the encrypted document, and the returneddecis a readable stream containing the plaintext.Issue reference
Tracked by: dapr/dapr#6147
Proposal: dapr/proposals#3
Checklist