]> git.immae.eu Git - github/fretlink/terraform-provider-statuscake.git/blob - vendor/github.com/hashicorp/terraform/plugin/discovery/signature.go
Upgrade to 0.12
[github/fretlink/terraform-provider-statuscake.git] / vendor / github.com / hashicorp / terraform / plugin / discovery / signature.go
1 package discovery
2
3 import (
4 "bytes"
5 "strings"
6
7 "golang.org/x/crypto/openpgp"
8 )
9
10 // Verify the data using the provided openpgp detached signature and the
11 // embedded hashicorp public key.
12 func verifySig(data, sig []byte, armor string) (*openpgp.Entity, error) {
13 el, err := openpgp.ReadArmoredKeyRing(strings.NewReader(armor))
14 if err != nil {
15 return nil, err
16 }
17
18 return openpgp.CheckDetachedSignature(el, bytes.NewReader(data), bytes.NewReader(sig))
19 }