mirror of
				https://github.com/optim-enterprises-bv/vault.git
				synced 2025-10-31 02:28:09 +00:00 
			
		
		
		
	fix: PGP subkeys support (#16224)
* fix: PGP subkeys support Signed-off-by: Yoan Blanc <yoan@dosimple.ch> * fix: bump ProtonMail/go-crypto Signed-off-by: Yoan Blanc <yoan@dosimple.ch> * fix: bump ProtonMail/go-crypto Signed-off-by: Yoan Blanc <yoan@dosimple.ch> Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
This commit is contained in:
		
							
								
								
									
										3
									
								
								changelog/16224.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								changelog/16224.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | ||||
| ```release-note:bug | ||||
| core: fix GPG encryption to support subkeys. | ||||
| ``` | ||||
| @@ -13,8 +13,8 @@ import ( | ||||
| 	"github.com/hashicorp/vault/helper/pgpkeys" | ||||
| 	"github.com/hashicorp/vault/vault" | ||||
|  | ||||
| 	"github.com/keybase/go-crypto/openpgp" | ||||
| 	"github.com/keybase/go-crypto/openpgp/packet" | ||||
| 	"github.com/ProtonMail/go-crypto/openpgp" | ||||
| 	"github.com/ProtonMail/go-crypto/openpgp/packet" | ||||
| ) | ||||
|  | ||||
| func getPubKeyFiles(t *testing.T) (string, []string, error) { | ||||
|   | ||||
							
								
								
									
										3
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								go.mod
									
									
									
									
									
								
							| @@ -22,6 +22,7 @@ require ( | ||||
| 	github.com/Azure/go-autorest/autorest v0.11.24 | ||||
| 	github.com/Azure/go-autorest/autorest/adal v0.9.18 | ||||
| 	github.com/NYTimes/gziphandler v1.1.1 | ||||
| 	github.com/ProtonMail/go-crypto v0.0.0-20220824120805-4b6e5c587895 | ||||
| 	github.com/SAP/go-hdb v0.14.1 | ||||
| 	github.com/Sectorbob/mlab-ns2 v0.0.0-20171030222938-d3aa0c295a8a | ||||
| 	github.com/aerospike/aerospike-client-go/v5 v5.6.0 | ||||
| @@ -140,7 +141,6 @@ require ( | ||||
| 	github.com/jefferai/isbadcipher v0.0.0-20190226160619-51d2077c035f | ||||
| 	github.com/jefferai/jsonx v1.0.0 | ||||
| 	github.com/joyent/triton-go v1.7.1-0.20200416154420-6801d15b779f | ||||
| 	github.com/keybase/go-crypto v0.0.0-20190403132359-d65b6b94177f | ||||
| 	github.com/kr/pretty v0.3.0 | ||||
| 	github.com/kr/text v0.2.0 | ||||
| 	github.com/mattn/go-colorable v0.1.12 | ||||
| @@ -254,6 +254,7 @@ require ( | ||||
| 	github.com/cespare/xxhash/v2 v2.1.1 // indirect | ||||
| 	github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible // indirect | ||||
| 	github.com/circonus-labs/circonusllhist v0.1.3 // indirect | ||||
| 	github.com/cloudflare/circl v1.1.0 // indirect | ||||
| 	github.com/cloudfoundry-community/go-cfclient v0.0.0-20210823134051-721f0e559306 // indirect | ||||
| 	github.com/containerd/cgroups v1.0.3 // indirect | ||||
| 	github.com/containerd/containerd v1.5.13 // indirect | ||||
|   | ||||
							
								
								
									
										7
									
								
								go.sum
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								go.sum
									
									
									
									
									
								
							| @@ -183,6 +183,8 @@ github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMo | ||||
| github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= | ||||
| github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= | ||||
| github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= | ||||
| github.com/ProtonMail/go-crypto v0.0.0-20220824120805-4b6e5c587895 h1:NsReiLpErIPzRrnogAXYwSoU7txA977LjDGrbkewJbg= | ||||
| github.com/ProtonMail/go-crypto v0.0.0-20220824120805-4b6e5c587895/go.mod h1:UBYPn8k0D56RtnR8RFQMjmh4KrZzWJ5o7Z9SYjossQ8= | ||||
| github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= | ||||
| github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= | ||||
| github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI= | ||||
| @@ -300,6 +302,7 @@ github.com/buger/jsonparser v0.0.0-20180808090653-f4dd9f5a6b44/go.mod h1:bbYlZJ7 | ||||
| github.com/bugsnag/bugsnag-go v0.0.0-20141110184014-b1d153021fcd/go.mod h1:2oa8nejYd4cQ/b0hMIopN0lCRxU0bueqREvZLWFrtK8= | ||||
| github.com/bugsnag/osext v0.0.0-20130617224835-0dd3f918b21b/go.mod h1:obH5gd0BsqsP2LwDJ9aOkm/6J86V6lyAXCoQWGw3K50= | ||||
| github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0/go.mod h1:D/8v3kj0zr8ZAKg1AQ6crr+5VwKN5eIywRkfhyM/+dE= | ||||
| github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= | ||||
| github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= | ||||
| github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= | ||||
| github.com/cenkalti/backoff/v3 v3.0.0/go.mod h1:cIeZDE3IrqwwJl6VUwCN6trj1oXrTS4rc0ij+ULvLYs= | ||||
| @@ -334,6 +337,8 @@ github.com/circonus-labs/circonusllhist v0.1.3 h1:TJH+oke8D16535+jHExHj4nQvzlZrj | ||||
| github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= | ||||
| github.com/client9/misspell v0.3.4 h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI= | ||||
| github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= | ||||
| github.com/cloudflare/circl v1.1.0 h1:bZgT/A+cikZnKIwn7xL2OBj012Bmvho/o6RpRvv3GKY= | ||||
| github.com/cloudflare/circl v1.1.0/go.mod h1:prBCrKB9DV4poKZY1l9zBXg2QJY7mvgRvtMxxK7fi4I= | ||||
| github.com/cloudfoundry-community/go-cfclient v0.0.0-20210823134051-721f0e559306 h1:k8q2Nsz7kNaUlysVCnWIFLMUSqiKXaGLdIf9P0GsX2Y= | ||||
| github.com/cloudfoundry-community/go-cfclient v0.0.0-20210823134051-721f0e559306/go.mod h1:0FdHblxw7g3M2PPICOw9i8YZOHP9dZTHbJUtoxL7Z/E= | ||||
| github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= | ||||
| @@ -1281,8 +1286,6 @@ github.com/karrick/godirwalk v1.8.0/go.mod h1:H5KPZjojv4lE+QYImBI8xVtrBRgYrIVsaR | ||||
| github.com/karrick/godirwalk v1.10.3/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA= | ||||
| github.com/kelseyhightower/envconfig v1.4.0 h1:Im6hONhd3pLkfDFsbRgu68RDNkGF1r3dvMUtDTo2cv8= | ||||
| github.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg= | ||||
| github.com/keybase/go-crypto v0.0.0-20190403132359-d65b6b94177f h1:Gsc9mVHLRqBjMgdQCghN9NObCcRncDqxJvBvEaIIQEo= | ||||
| github.com/keybase/go-crypto v0.0.0-20190403132359-d65b6b94177f/go.mod h1:ghbZscTyKdM07+Fw3KSi0hcJm+AlEUWj8QLlPtijN/M= | ||||
| github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= | ||||
| github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= | ||||
| github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= | ||||
|   | ||||
| @@ -5,8 +5,8 @@ import ( | ||||
| 	"encoding/base64" | ||||
| 	"fmt" | ||||
|  | ||||
| 	"github.com/keybase/go-crypto/openpgp" | ||||
| 	"github.com/keybase/go-crypto/openpgp/packet" | ||||
| 	"github.com/ProtonMail/go-crypto/openpgp" | ||||
| 	"github.com/ProtonMail/go-crypto/openpgp/packet" | ||||
| ) | ||||
|  | ||||
| // EncryptShares takes an ordered set of byte slices to encrypt and the | ||||
|   | ||||
| @@ -8,7 +8,7 @@ import ( | ||||
| 	"os" | ||||
| 	"strings" | ||||
|  | ||||
| 	"github.com/keybase/go-crypto/openpgp" | ||||
| 	"github.com/ProtonMail/go-crypto/openpgp" | ||||
| ) | ||||
|  | ||||
| // PubKeyFileFlag implements flag.Value and command.Example to receive exactly | ||||
|   | ||||
| @@ -12,8 +12,8 @@ import ( | ||||
| 	"strings" | ||||
| 	"testing" | ||||
|  | ||||
| 	"github.com/keybase/go-crypto/openpgp" | ||||
| 	"github.com/keybase/go-crypto/openpgp/packet" | ||||
| 	"github.com/ProtonMail/go-crypto/openpgp" | ||||
| 	"github.com/ProtonMail/go-crypto/openpgp/packet" | ||||
| ) | ||||
|  | ||||
| func TestPubKeyFilesFlag_implements(t *testing.T) { | ||||
|   | ||||
| @@ -6,9 +6,9 @@ import ( | ||||
| 	"fmt" | ||||
| 	"strings" | ||||
|  | ||||
| 	"github.com/ProtonMail/go-crypto/openpgp" | ||||
| 	cleanhttp "github.com/hashicorp/go-cleanhttp" | ||||
| 	"github.com/hashicorp/vault/sdk/helper/jsonutil" | ||||
| 	"github.com/keybase/go-crypto/openpgp" | ||||
| ) | ||||
|  | ||||
| const ( | ||||
|   | ||||
| @@ -7,8 +7,8 @@ import ( | ||||
| 	"reflect" | ||||
| 	"testing" | ||||
|  | ||||
| 	"github.com/keybase/go-crypto/openpgp" | ||||
| 	"github.com/keybase/go-crypto/openpgp/packet" | ||||
| 	"github.com/ProtonMail/go-crypto/openpgp" | ||||
| 	"github.com/ProtonMail/go-crypto/openpgp/packet" | ||||
| ) | ||||
|  | ||||
| func TestFetchKeybasePubkeys(t *testing.T) { | ||||
|   | ||||
| @@ -12,11 +12,11 @@ import ( | ||||
| 	"github.com/hashicorp/vault/sdk/helper/jsonutil" | ||||
| 	"github.com/hashicorp/vault/sdk/physical" | ||||
|  | ||||
| 	"github.com/ProtonMail/go-crypto/openpgp" | ||||
| 	"github.com/ProtonMail/go-crypto/openpgp/packet" | ||||
| 	"github.com/golang/protobuf/proto" | ||||
| 	wrapping "github.com/hashicorp/go-kms-wrapping/v2" | ||||
| 	"github.com/hashicorp/vault/vault/seal" | ||||
| 	"github.com/keybase/go-crypto/openpgp" | ||||
| 	"github.com/keybase/go-crypto/openpgp/packet" | ||||
| ) | ||||
|  | ||||
| const ( | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Yoan Blanc
					Yoan Blanc