Skip to content
This repository has been archived by the owner on Mar 27, 2024. It is now read-only.

feat: Authcrypt Encrypt Using (X)Chach20Poly1035 #107

Merged
merged 1 commit into from
Aug 22, 2019

Conversation

baha-ai
Copy link
Contributor

@baha-ai baha-ai commented Aug 13, 2019

This change adds support to encrypt agent's payloads
for the Pack() call at the transport layer

Signed-off-by: Baha Shaaban baha.shaaban@securekey.com

Title:
Authcrypt Encrypt Using (X)Chach20Poly1035

Description:
This is part of #37 and allows encrypting payloads at the transport layer of DidComm Agent

Summary:

This PR adds support to encrypt payloads using (X)Chacha20Poly35 IETF authenticated encryption.

Closes: #150

@codecov-io
Copy link

codecov-io commented Aug 13, 2019

Codecov Report

Merging #107 into master will increase coverage by 0.55%.
The diff coverage is 83.85%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #107      +/-   ##
=========================================
+ Coverage   89.95%   90.5%   +0.55%     
=========================================
  Files          24      26       +2     
  Lines         816     906      +90     
=========================================
+ Hits          734     820      +86     
- Misses         44      47       +3     
- Partials       38      39       +1
Impacted Files Coverage Δ
pkg/framework/didresolver/api.go 100% <ø> (ø) ⬆️
pkg/didcomm/crypto/jwe/authcrypt/decrypt.go 0% <0%> (ø)
pkg/didmethod/peer/resolver.go 71.42% <33.33%> (ø) ⬆️
pkg/framework/didresolver/didresolver.go 94.11% <75%> (ø) ⬆️
pkg/didcomm/crypto/jwe/authcrypt/encrypt.go 84.28% <84.28%> (ø)
pkg/didmethod/httpbinding/resolver.go 90.69% <90.69%> (+3.46%) ⬆️
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e07ec51...26d7f78. Read the comment docs.

@troyronda
Copy link
Contributor

Test coverage is a bit low.

@troyronda
Copy link
Contributor

@Baha-sk Does this close #37 now?

@baha-ai baha-ai force-pushed the issue-37 branch 2 times, most recently from 5735a9e to 15f45d6 Compare August 21, 2019 18:37
doc.go Outdated Show resolved Hide resolved
pkg/didcomm/crypto/crypter.go Outdated Show resolved Hide resolved
pkg/didcomm/crypto/jwe/authcrypt/decrypt.go Outdated Show resolved Hide resolved
pkg/didcomm/crypto/jwe/authcrypt/decrypt.go Outdated Show resolved Hide resolved
pkg/didcomm/crypto/jwe/authcrypt/decrypt.go Show resolved Hide resolved
pkg/didcomm/crypto/jwe/authcrypt/encrypt.go Outdated Show resolved Hide resolved
pkg/didcomm/crypto/jwe/authcrypt/encrypt.go Outdated Show resolved Hide resolved
pkg/didcomm/crypto/jwe/authcrypt/encrypt.go Outdated Show resolved Hide resolved
pkg/didcomm/crypto/jwe/authcrypt/encrypt.go Outdated Show resolved Hide resolved
@@ -0,0 +1,104 @@
/*
Copy link
Contributor

@troyronda troyronda Aug 22, 2019

Choose a reason for hiding this comment

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

We need test cases.

  • against externally generated cases.
  • against internal methods (when they are available).

(I don't see a TODO with a plan.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I do have a test case that generates a JWE using the PHP example keys, but we can't compare the cipher output as it's based on cryptographically random keys/nonce generation

Copy link
Contributor Author

@baha-ai baha-ai Aug 22, 2019

Choose a reason for hiding this comment

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

pushed a patch with a TODO comment... will definitely need to test interoperability with other libraries (like the reference php one: https://github.com/gamringer/php-authcrypt)

Moopli pushed a commit to Moopli/aries-framework-go that referenced this pull request Aug 22, 2019
Begins:
- Defining JSON structure for messages
- Building crypter

Note: expected to involve a fair bit of code duplication with PR hyperledger-archives#107.
Refactoring will follow.

Signed-off-by: Filip Burlacu <filip.burlacu@securekey.com>
@baha-ai baha-ai force-pushed the issue-37 branch 2 times, most recently from 3ec6ef1 to 55757c6 Compare August 22, 2019 16:50
@baha-ai baha-ai force-pushed the issue-37 branch 2 times, most recently from eda76ac to 66bcc2a Compare August 22, 2019 18:10
@baha-ai baha-ai force-pushed the issue-37 branch 3 times, most recently from ee97025 to 6488ee7 Compare August 22, 2019 19:33
pkg/didcomm/crypto/crypter.go Outdated Show resolved Hide resolved
pkg/didcomm/crypto/crypter.go Outdated Show resolved Hide resolved
pkg/didcomm/crypto/jwe/authcrypt/decrypt.go Outdated Show resolved Hide resolved
pkg/didcomm/crypto/jwe/authcrypt/encrypt.go Outdated Show resolved Hide resolved
pkg/didcomm/crypto/jwe/authcrypt/encrypt.go Outdated Show resolved Hide resolved
pkg/didcomm/crypto/jwe/authcrypt/encrypt.go Outdated Show resolved Hide resolved
@baha-ai baha-ai force-pushed the issue-37 branch 3 times, most recently from fb6f9d3 to 0e5bcfb Compare August 22, 2019 20:54
	This change adds support to encrypt agent's payloads
	for the Pack() call at the transport layer

	It follows JWE encryption instructions from Aries
	Issue: hyperledger/aries-rfcs#133

Signed-off-by: Baha Shaaban <baha.shaaban@securekey.com>
@troyronda troyronda merged commit 569e541 into hyperledger-archives:master Aug 22, 2019
Moopli pushed a commit to Moopli/aries-framework-go that referenced this pull request Aug 23, 2019
Begins:
- Defining JSON structure for messages
- Building crypter

Note: expected to involve a fair bit of code duplication with PR hyperledger-archives#107.
Refactoring will follow.

Signed-off-by: Filip Burlacu <filip.burlacu@securekey.com>
@baha-ai baha-ai deleted the issue-37 branch September 4, 2019 20:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

Encrypt (X)Chacha20Poly1035 envelope
7 participants