github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/libkb/pgp_clean_test.go (about) 1 // Copyright 2015 Keybase, Inc. All rights reserved. Use of 2 // this source code is governed by the included BSD license. 3 4 package libkb 5 6 import ( 7 "encoding/base64" 8 require "github.com/stretchr/testify/require" 9 "testing" 10 ) 11 12 func TestKeithWinstein(t *testing.T) { 13 14 var err error 15 // Encode the key with spaces as a Base64-encoded string, since trailing 16 // spaces don't survive our various text editors 17 key64 := "LS0tLS1CRUdJTiBQR1AgUFVCTElDIEtFWSBCTE9DSy0tLS0tClZlcnNpb246IEdudVBHIHYxCgptUUlOQkU4dXorWUJFQURSbFZXSEZvem5TcC9vb010OGdIZDVZVGt5aGFQUVdCbXBaRzZFUkp0dGdMakF2TWRRCmE0ZlVVOTk0ZE5mdTBBVGNhbWVkUmNNdEtjQ0NWTTZETE1NWjNJVnhhWXg0SjY1OEJnVEcvK21iVnI5UkJRUUMKcXM4OWNRQ0dianBFRnZKSGNnc2lLNldNcVlWVXFvOUpxYzlEWFZlYThpVGpjQVV2a202OGFkMnBuRi9ZNUVFSwp3Rndaem43S3lkMEtoYmhlNmZCcElxeWVvcWJtL2lyMXpSd2JRWktJRzhqTGtER3hQMHlTcFh4VXFPVHBXYWxsCmQxcTF1SzdhT0pnTDYzWUZFdSs1VU5DU1Y1T2VabCtXb21yay96M0NwdmVyZ1BndHd3eEU4WlFOeU41MzR3VUgKZ1BLUkpRTEtGQjU4RE53WXJNRnZtdlVLT3J1UHU1czd4UDBCb2luOGRWRWcrRCtVMEN6UlNIcDU3UXQrNlNtOQpZOWpHcmRyQW1uZURhRjhuaWhlc1ZDUDNldG1IZEUxcXBZa0E1TlhKK3k4V2YyNWdxUjBRK21EbnE2QjlON1VJCkdCQk9jbDByWUZYSCtHNE52eG5OZUJjN3IxeHdiZkdKWUt6V21CV2ZwbzQ4bThWeXpKQ1lPSDBnMWJSRk4ydTYKU09JZ2JjbWRnNFFHVWhudHRDUllsYS9YYUV2QVA5cDlFW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UUU0WU5QeThRZlJUbUV3c0VZMGZUaW4vTjR4Rm0rSG92U3ZKbUp0RW50bDZzb0UKWXFLRDltOTl6ZEpCeDB4cjdTNEV1QkNkRjJFM281bjlYbjFQNXA3OXN2bGttamVkYjBJaTJudGFRS1hnSmVFRgp6amJnZHdzY0dKZy9jRVdwaGs0V2xzR2FqVFRrdld0MnlvanZMRUdOaU1RZmd2V1gzbytXU0VRaTJ3YklnS01hCkI3clJiTGdMQ0xraXBVZVB1dDZkcklaeVRYNGdRazZBWnZGMGloUjJBNWpzYzY3NnQ2OXpiU0hPdmxGOVY3NEUKMFYyaXNsZzJPWTl6TDkzVzlEKzh4bmdkdmE5RVlWdzljR3VuazNITGUvdHRVSUMzNTFTNGRhU1V2MlRrTGdmegpzWXFLL0syUkFuYmxqMStncWM3WHFFYXh2b0d1V3ljMmp2SyszWFBOVTQwdEtaV3pGT0hwMTRpNWFlL1JmQzAvCnppQ1pKK3JEdjlaNFpSMERvTXNiZmtqcGs1b254MHAveU5WVk1NYmdkanNubm1UMnZOWDgzNmpOUEg0SmZidjkKbSt5Skx5V0FGY2FyRU9STHRTN0FWeG1BVzRPRm9uZnRjQ3NLaGtIRWpSb2VINVJmbGs0VVJLNzkveG42b3hLaQpJYzh4emt0SWtqWEpVbFVENjJYZ1BwcW5XTXZlT1NrVGlGa21oUG5kZmNOVURwOCtleVc0dEY2TTNJcDBML3A3ClU3SDNJK3NQNnhQVlV4NXB2VUZRdFFoNWJmdWt4TStQc3RvQ09oNSt4TW5mc2dLNHg2RFAzSWE4VmtxRm8yckUKKzJFWDROZ3RyK2lvbzlRbS9qSDZGenlOZXJ6RjlwU2RsZzVmK25xUXNrSHljVlJxdituMU11RS82czA4Cj0zY1VSCi0tLS0tRU5EIFBHUCBQVUJMSUMgS0VZIEJMT0NLLS0tLS0K" 18 key, err := base64.StdEncoding.DecodeString(key64) 19 if err != nil { 20 t.Fatal(err) 21 } else if _, _, err = ReadOneKeyFromString(string(key)); err != nil { 22 t.Fatal(err) 23 } 24 } 25 26 func TestBug8612Prepass(t *testing.T) { 27 28 whackyKey := `-----BEGIN PGP PUBLIC KEY BLOCK----- [1/2] 29 30 mI0EWcknrwEEAK2X5lKA76pf6i5D1aVcApUAH6NnZ4NkFeSxKT92soiSWkFn+I/G 31 VKJfTvx2dzxOAB4rvyFjUzjgAwhK3FblCnfXwgPAh6/vukF/YBwynCVyNxOVAVHY 32 gCkw/+7zIM24RUxzI3V9wzJ6i/SpfNnWKkKqJXIt4Xzv3Rs/UXk5DMY5ABEBAAG0 33 I01heCBUZXN0IDc3NyA8dGhlbWF4Kzc3N0BnbWFpbC5jb20+iLgEEwECACIFAlnJ 34 J68CGwMGCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheAAAoJEM5jclcHa4v8ssQD/RJA 35 JTrfydAkLzffGgZyKafs/aTraVDNtDv1sF+5iBtZvOB0FFjzivl3BGlplEqnPquB 36 bg8/OQuxFLYM/f8+WgP5MDqBce8s6h5kGZPj73zP4GQLZWojS5/H3J1sDBmNTSnd 37 ByELhvVxJmJiHdz2jMb74+thB/ZK4xf+zAkRF4WZuI0EWcknrwEEALk0Bsp/xJ+4 38 75hswySLZmvNh79CyIC0K1gzXiEPDwqGy6xT1PbXLJ5HcXna4HJdNAgXf1T/n+zR 39 19xJMAB6NSv2zigRaYAyy4It2p2cRPHseWWTcP7lMUpwqtQsnqNKJ14RuAaMOQtG 40 xSaQMgMGZx6lxFWNaK40SxSnqFRtfRs9ABEBAAGInwQYAQIACQUCWcknrwIbDAAK 41 CRDOY3JXB2uL/PX/A/9HvpLPVDrEMr9+vzmS8Ez0br2kgeoPh7yOAlEotS7OBNWU 42 UzzykQlAfLl74336wrkSZfa2GnBBJQHvlnLosnmbGCzsd3KMkuJv90hxxt1rqjN6 43 3GFiwBVdsSuyEb3uQJ/ytAyVozwwxjMQZ+gJTYfK8syPdf2T1W6cv7lfHp8E8g== 44 =sJQD 45 -----END PGP PUBLIC KEY BLOCK-----` 46 47 regularKey := `-----BEGIN PGP PUBLIC KEY BLOCK----- 48 49 mI0EWcknrwEEAK2X5lKA76pf6i5D1aVcApUAH6NnZ4NkFeSxKT92soiSWkFn+I/G 50 VKJfTvx2dzxOAB4rvyFjUzjgAwhK3FblCnfXwgPAh6/vukF/YBwynCVyNxOVAVHY 51 gCkw/+7zIM24RUxzI3V9wzJ6i/SpfNnWKkKqJXIt4Xzv3Rs/UXk5DMY5ABEBAAG0 52 I01heCBUZXN0IDc3NyA8dGhlbWF4Kzc3N0BnbWFpbC5jb20+iLgEEwECACIFAlnJ 53 J68CGwMGCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheAAAoJEM5jclcHa4v8ssQD/RJA 54 JTrfydAkLzffGgZyKafs/aTraVDNtDv1sF+5iBtZvOB0FFjzivl3BGlplEqnPquB 55 bg8/OQuxFLYM/f8+WgP5MDqBce8s6h5kGZPj73zP4GQLZWojS5/H3J1sDBmNTSnd 56 ByELhvVxJmJiHdz2jMb74+thB/ZK4xf+zAkRF4WZuI0EWcknrwEEALk0Bsp/xJ+4 57 75hswySLZmvNh79CyIC0K1gzXiEPDwqGy6xT1PbXLJ5HcXna4HJdNAgXf1T/n+zR 58 19xJMAB6NSv2zigRaYAyy4It2p2cRPHseWWTcP7lMUpwqtQsnqNKJ14RuAaMOQtG 59 xSaQMgMGZx6lxFWNaK40SxSnqFRtfRs9ABEBAAGInwQYAQIACQUCWcknrwIbDAAK 60 CRDOY3JXB2uL/PX/A/9HvpLPVDrEMr9+vzmS8Ez0br2kgeoPh7yOAlEotS7OBNWU 61 UzzykQlAfLl74336wrkSZfa2GnBBJQHvlnLosnmbGCzsd3KMkuJv90hxxt1rqjN6 62 3GFiwBVdsSuyEb3uQJ/ytAyVozwwxjMQZ+gJTYfK8syPdf2T1W6cv7lfHp8E8g== 63 =sJQD 64 -----END PGP PUBLIC KEY BLOCK-----` 65 66 require.Equal(t, regularKey, bug8612Prepass(regularKey)) 67 require.Equal(t, regularKey, bug8612Prepass(whackyKey)) 68 69 _, _, err := ReadOneKeyFromString(whackyKey) 70 require.Error(t, err) 71 _, _, err = ReadOneKeyFromStringLiberal(whackyKey) 72 require.NoError(t, err) 73 74 }