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

Implement signing of pre-hashed data #3448

Merged
merged 1 commit into from
Oct 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions builtin/logical/transit/path_sign_verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ derivation is enabled; currently only available with ed25519 keys.`,
Default: "sha2-256",
Description: `Hash algorithm to use (POST body parameter). Valid values are:

* none
* sha2-224
* sha2-256
* sha2-384
Expand Down Expand Up @@ -108,6 +109,7 @@ derivation is enabled; currently only available with ed25519 keys.`,
Default: "sha2-256",
Description: `Hash algorithm to use (POST body parameter). Valid values are:

* none
* sha2-224
* sha2-256
* sha2-384
Expand Down Expand Up @@ -166,7 +168,7 @@ func (b *backend) pathSignWrite(
}
}

if p.Type.HashSignatureInput() {
if p.Type.HashSignatureInput() && algorithm != "none" {
var hf hash.Hash
switch algorithm {
case "sha2-224":
Expand Down Expand Up @@ -259,7 +261,7 @@ func (b *backend) pathVerifyWrite(
}
}

if p.Type.HashSignatureInput() {
if p.Type.HashSignatureInput() && algorithm != "none" {
var hf hash.Hash
switch algorithm {
case "sha2-224":
Expand Down
4 changes: 4 additions & 0 deletions builtin/logical/transit/path_sign_verify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ func TestTransit_SignVerify_P256(t *testing.T) {
sig = signRequest(req, false, "")
verifyRequest(req, false, "", sig)

req.Data["algorithm"] = "none"
sig = signRequest(req, false, "")
verifyRequest(req, false, "", sig)

// Test 512 and save sig for later to ensure we can't validate once min
// decryption version is set
req.Data["algorithm"] = "sha2-512"
Expand Down
2 changes: 2 additions & 0 deletions website/source/api/secret/transit/index.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,7 @@ supports signing.
own hash algorithm). This can also be specified as part of the URL.
Currently-supported algorithms are:

- `none`
- `sha2-224`
- `sha2-256`
- `sha2-384`
Expand Down Expand Up @@ -831,6 +832,7 @@ data.
- `algorithm` `(string: "sha2-256")` – Specifies the hash algorithm to use. This
can also be specified as part of the URL. Currently-supported algorithms are:

- `none`
- `sha2-224`
- `sha2-256`
- `sha2-384`
Expand Down