]> git.immae.eu Git - github/fretlink/terraform-provider-statuscake.git/blame - 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
CommitLineData
c680a8e1
RS
1package discovery
2
3import (
4 "bytes"
c680a8e1
RS
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.
107c1cdb
ND
12func verifySig(data, sig []byte, armor string) (*openpgp.Entity, error) {
13 el, err := openpgp.ReadArmoredKeyRing(strings.NewReader(armor))
c680a8e1 14 if err != nil {
107c1cdb 15 return nil, err
c680a8e1
RS
16 }
17
107c1cdb 18 return openpgp.CheckDetachedSignature(el, bytes.NewReader(data), bytes.NewReader(sig))
c680a8e1 19}