This repository has been archived by the owner on Mar 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add main crypto interfaces and proto buffs for a new ECDH-ES kw…
…+AEAD Tink primtive type This is a first change for Anoncrypt crypto primitives mainly called Composite primitives. Following changes will build on top of this change, namely the crypto primitives, Tink templates and helpers to complete full ECDH-ES key wrapping + AEAD content encryption logic needed for building and parsing JWE messages. part of #1469 Signed-off-by: Baha Shaaban <[email protected]>
- Loading branch information
Baha Shaaban
committed
Apr 17, 2020
1 parent
9decd33
commit 509d21a
Showing
10 changed files
with
682 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,5 @@ coverage: | |
|
||
ignore: | ||
- "test/bdd" # ignore bdd tests | ||
- "protos" | ||
- "pkg/crypto/tinkcrypto/primitive/proto" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
pkg/crypto/tinkcrypto/primitive/composite/api/composite_decrypt.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
Copyright SecureKey Technologies Inc. All Rights Reserved. | ||
SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package api | ||
|
||
// CompositeDecrypt will decrypt a `ciphertext` representing a composite encryption with a protected cek for the | ||
// recipient caller of this interface. In order to get the plaintext embedded, this type is configured with the | ||
// recipient key type that will decrypt the embedded cek first. This type is used mainly for repudiation requests where | ||
// the sender identity remains unknown using ECDH-ES key wrapping with an ephemeral sender key. | ||
type CompositeDecrypt interface { | ||
// Decrypt operation: decrypts ciphertext representing a serialized EncryptedData (mainly extracted from a | ||
// JWE message) for a given recipient. It extracts the underlying secure material then executes key unwrapping of | ||
// the cek and the AEAD decrypt primitive. | ||
// returns resulting plaintext extracted from the serialized object. | ||
Decrypt(cipherText, additionalData []byte) ([]byte, error) | ||
} |
16 changes: 16 additions & 0 deletions
16
pkg/crypto/tinkcrypto/primitive/composite/api/composite_encrypt.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
Copyright SecureKey Technologies Inc. All Rights Reserved. | ||
SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package api | ||
|
||
// CompositeEncrypt will encrypt a `plaintext` using AEAD primitive and ECDH-ES key wrapping by recipient | ||
// It returns the resulting serialized JWE []byte. This type is used mainly for repudiation requests where the sender | ||
// identity remains unknown to the recipient in a serialized EncryptedData envelope (used mainly to build JWE messages). | ||
type CompositeEncrypt interface { | ||
// Encrypt operation: encrypts plaintext with aad represented as the list of recipient's corresponding public keys | ||
// Returns resulting EncryptedData wrapping ciphertext and the recipients protected keys or error if failed. | ||
Encrypt(plainText, aad []byte) ([]byte, error) | ||
} |
Oops, something went wrong.