Skip to content

Commit f346d96

Browse files
Merge pull request #54 from goark/support-rfc4880bis
Support draft-ietf-openpgp-crypto-refresh-07
2 parents 96e1388 + c27161e commit f346d96

40 files changed

+989
-450
lines changed

.github/workflows/build.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,21 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- name: Checkout
12-
uses: actions/checkout@v2
12+
uses: actions/checkout@v3
1313
with:
1414
fetch-depth: 0
1515
- name: Set up Go
16-
uses: actions/setup-go@v2
16+
uses: actions/setup-go@v3
1717
with:
18-
go-version: 1.17
18+
go-version: ^1.19.3
1919
- name: Run GoReleaser
20-
uses: goreleaser/goreleaser-action@v2
20+
uses: goreleaser/goreleaser-action@v3
2121
with:
22+
# either 'goreleaser' (default) or 'goreleaser-pro'
23+
distribution: goreleaser
2224
version: latest
2325
args: release --rm-dist
2426
env:
2527
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution
29+
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}

.github/workflows/codeql-analysis.yml

Lines changed: 38 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -12,55 +12,47 @@ on:
1212
# The branches below must be a subset of the branches above
1313
branches: [master]
1414
schedule:
15-
- cron: '0 22 * * 5'
15+
- cron: '0 20 * * 0'
1616

1717
jobs:
18-
analyze:
19-
name: Analyze
18+
CodeQL-Build:
19+
# CodeQL runs on ubuntu-latest, windows-latest, and macos-latest
2020
runs-on: ubuntu-latest
2121

22-
strategy:
23-
fail-fast: false
24-
matrix:
25-
# Override automatic language detection by changing the below list
26-
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
27-
language: ['go']
28-
# Learn more...
29-
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection
22+
permissions:
23+
# required for all workflows
24+
security-events: write
3025

31-
steps:
32-
- name: Checkout repository
33-
uses: actions/checkout@v2
34-
with:
35-
# We must fetch at least the immediate parents so that if this is
36-
# a pull request then we can checkout the head.
37-
fetch-depth: 2
38-
39-
# Initializes the CodeQL tools for scanning.
40-
- name: Initialize CodeQL
41-
uses: github/codeql-action/init@v1
42-
with:
43-
languages: ${{ matrix.language }}
44-
# If you wish to specify custom queries, you can do so here or in a config file.
45-
# By default, queries listed here will override any specified in a config file.
46-
# Prefix the list here with "+" to use these queries and those in the config file.
47-
# queries: ./path/to/local/query, your-org/your-repo/queries@main
48-
49-
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
50-
# If this step fails, then you should remove it and run the build manually (see below)
51-
- name: Autobuild
52-
uses: github/codeql-action/autobuild@v1
53-
54-
# ℹ️ Command-line programs to run using the OS shell.
55-
# 📚 https://git.io/JvXDl
26+
# only required for workflows in private repositories
27+
actions: read
28+
contents: read
5629

57-
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
58-
# and modify them (or add more) to build your code if your project
59-
# uses a compiled language
60-
61-
#- run: |
62-
# make bootstrap
63-
# make release
64-
65-
- name: Perform CodeQL Analysis
66-
uses: github/codeql-action/analyze@v1
30+
steps:
31+
- name: Checkout repository
32+
uses: actions/checkout@v3
33+
34+
# Initializes the CodeQL tools for scanning.
35+
- name: Initialize CodeQL
36+
uses: github/codeql-action/init@v2
37+
# Override language selection by uncommenting this and choosing your languages
38+
with:
39+
languages: go
40+
41+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
42+
# If this step fails, then you should remove it and run the build manually (see below).
43+
- name: Autobuild
44+
uses: github/codeql-action/autobuild@v2
45+
46+
# ℹ️ Command-line programs to run using the OS shell.
47+
# 📚 https://git.io/JvXDl
48+
49+
# ✏️ If the Autobuild fails above, remove it and uncomment the following
50+
# three lines and modify them (or add more) to build your code if your
51+
# project uses a compiled language
52+
53+
#- run: |
54+
# make bootstrap
55+
# make release
56+
57+
- name: Perform CodeQL Analysis
58+
uses: github/codeql-action/analyze@v2

.github/workflows/lint.yml

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,43 @@ on:
44
branches:
55
- master
66
pull_request:
7+
8+
permissions:
9+
contents: read
10+
# Optional: allow read access to pull request. Use with `only-new-issues` option.
11+
# pull-requests: read
712
jobs:
813
golangci:
914
name: lint
1015
runs-on: ubuntu-latest
1116
steps:
12-
- uses: actions/checkout@v2
13-
- uses: actions/setup-go@v2
17+
- uses: actions/checkout@v3
18+
- uses: actions/setup-go@v3
1419
with:
15-
go-version: ^1.17
20+
go-version-file: 'go.mod'
1621
- name: golangci-lint
17-
uses: golangci/golangci-lint-action@v2
22+
uses: golangci/golangci-lint-action@v3
1823
with:
19-
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
24+
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
2025
version: latest
26+
27+
# Optional: working directory, useful for monorepos
28+
# working-directory: somedir
29+
2130
# Optional: golangci-lint command line arguments.
2231
args: --enable gosec
32+
33+
# Optional: show only new issues if it's a pull request. The default value is `false`.
34+
# only-new-issues: true
35+
36+
# Optional: if set to true then the all caching functionality will be complete disabled,
37+
# takes precedence over all other caching options.
38+
# skip-cache: true
39+
40+
# Optional: if set to true then the action don't cache or restore ~/go/pkg.
41+
# skip-pkg-cache: true
42+
43+
# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
44+
# skip-build-cache: true
2345
- name: testing
2446
run: go test -shuffle on ./...

.github/workflows/vulns.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@ jobs:
99
name: Vulnerability scanner
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v2
13-
- uses: actions/setup-go@v2
12+
- uses: actions/checkout@v3
13+
- uses: actions/setup-go@v3
1414
with:
15-
go-version: ^1.17
15+
go-version: ^1.19
1616
- name: install depm
1717
run: go install github.com/goark/depm@latest
1818
- name: WriteGoList
1919
run: depm list --json > go.list
2020
- name: Nancy
2121
uses: sonatype-nexus-community/nancy-github-action@main
22+
with:
23+
nancyVersion: "v1.0.42"

Taskfile.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ tasks:
1818
cmds:
1919
- go mod verify
2020
- go test -shuffle on ./...
21-
- docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.44.2 golangci-lint run --enable gosec --timeout 3m0s ./...
21+
- docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.50.1 golangci-lint run --enable gosec --timeout 3m0s ./...
2222
sources:
2323
- ./go.mod
2424
- '**/*.go'
@@ -37,7 +37,7 @@ tasks:
3737
- rm -f ./go.sum
3838
- go clean -cache
3939
- go clean -modcache
40-
- go mod tidy -v -go=1.17
40+
- go mod tidy -v -go=1.19
4141

4242
graph:
4343
desc: Make grapth of dependency modules.

dependency.png

21.5 KB
Loading

facade/facade_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Symmetrically Encrypted Data Packet (tag 9) (56 bytes)
4141
Hashed Subpacket (6 bytes)
4242
Signature Creation Time (sub 2): 2015-01-24T02:52:15Z
4343
Unhashed Subpacket (10 bytes)
44-
Issuer (sub 16): 0x31fbfda95fbbfa18
44+
Issuer Key ID (sub 16): 0x31fbfda95fbbfa18
4545
Hash left 2 bytes
4646
36 1f
4747
ECDSA value r (256 bits)

go.mod

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
module github.com/goark/gpgpdump
22

3-
go 1.17
3+
go 1.19
44

55
require (
6-
github.com/ProtonMail/go-crypto v0.0.0-20220113124808-70ae35bab23f
6+
github.com/ProtonMail/go-crypto v0.0.0-20221026131551-cf6655e29de4
77
github.com/atotto/clipboard v0.1.4
88
github.com/goark/errs v1.1.0
99
github.com/goark/fetch v0.3.0
1010
github.com/goark/gocli v0.12.0
11-
github.com/spf13/cobra v1.4.0
11+
github.com/spf13/cobra v1.6.1
1212
)
1313

1414
require (
15-
github.com/inconshreveable/mousetrap v1.0.0 // indirect
15+
github.com/cloudflare/circl v1.1.0 // indirect
16+
github.com/inconshreveable/mousetrap v1.0.1 // indirect
1617
github.com/spf13/pflag v1.0.5 // indirect
17-
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 // indirect
18+
golang.org/x/crypto v0.4.0 // indirect
19+
golang.org/x/sys v0.3.0 // indirect
1820
)

go.sum

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,35 @@
1-
github.com/ProtonMail/go-crypto v0.0.0-20220113124808-70ae35bab23f h1:J2FzIrXN82q5uyUraeJpLIm7U6PffRwje2ORho5yIik=
2-
github.com/ProtonMail/go-crypto v0.0.0-20220113124808-70ae35bab23f/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo=
1+
github.com/ProtonMail/go-crypto v0.0.0-20221026131551-cf6655e29de4 h1:ra2OtmuW0AE5csawV4YXMNGNQQXvLRps3z2Z59OPO+I=
2+
github.com/ProtonMail/go-crypto v0.0.0-20221026131551-cf6655e29de4/go.mod h1:UBYPn8k0D56RtnR8RFQMjmh4KrZzWJ5o7Z9SYjossQ8=
33
github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4=
44
github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI=
5-
github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
5+
github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0=
6+
github.com/cloudflare/circl v1.1.0 h1:bZgT/A+cikZnKIwn7xL2OBj012Bmvho/o6RpRvv3GKY=
7+
github.com/cloudflare/circl v1.1.0/go.mod h1:prBCrKB9DV4poKZY1l9zBXg2QJY7mvgRvtMxxK7fi4I=
8+
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
69
github.com/goark/errs v1.1.0 h1:FKnyw4LVyRADIjM8Nj0Up6r0/y5cfADvZAd1E+tthXE=
710
github.com/goark/errs v1.1.0/go.mod h1:TtaPEoadm2mzqzfXdkkfpN2xuniCFm2q4JH+c1qzaqw=
811
github.com/goark/fetch v0.3.0 h1:2m32EGOLBi99RzI5urFfmv5++CMqfenVw7NH8z/lbX8=
912
github.com/goark/fetch v0.3.0/go.mod h1:sqDdPbbHeIjDVeHrgvzhHpkUr8X9pVC9DgJoVwU02x0=
1013
github.com/goark/gocli v0.12.0 h1:Be44HJtGaRb++QjRNDPFhQ/BeapZzjz6CwlqFvBVpC4=
1114
github.com/goark/gocli v0.12.0/go.mod h1:IqwaOFWHni1OZnOaqC3UpfAHQ/o321zm/Lvv13isR8w=
12-
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
13-
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
15+
github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc=
16+
github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
1417
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
15-
github.com/spf13/cobra v1.4.0 h1:y+wJpx64xcgO1V+RcnwW0LEHxTKRi2ZDPSBjWnrg88Q=
16-
github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g=
18+
github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA=
19+
github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY=
1720
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
1821
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
19-
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 h1:It14KIkyBFYkHkwZ7k45minvA9aorojkyjGk9KJ5B/w=
20-
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
22+
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
23+
golang.org/x/crypto v0.4.0 h1:UVQgzMY87xqpKNgb+kDsll2Igd33HszWHFLmpaRMq/8=
24+
golang.org/x/crypto v0.4.0/go.mod h1:3quD/ATkf6oY+rnes5c3ExXTbLc8mueNue5/DoinL80=
2125
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
2226
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
27+
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
28+
golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
29+
golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ=
30+
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
2331
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
2432
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
2533
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
2634
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
27-
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
35+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

parse/s2k/s2k.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@ import (
1212
"github.com/goark/gpgpdump/parse/values"
1313
)
1414

15-
//S2K - information of S2K packet
15+
// S2K - information of S2K packet
1616
type S2K struct {
1717
reader *reader.Reader
1818
hasIV bool
1919
}
2020

21-
//New returns new Pubkey instance
21+
// New returns new Pubkey instance
2222
func New(r *reader.Reader) *S2K {
2323
return &S2K{reader: r, hasIV: true}
2424
}
2525

26-
//Parse is parsing S2K packet
26+
// Parse is parsing S2K packet
2727
func (s *S2K) Parse(parent *result.Item, dumpFlag bool) error {
2828
if s == nil {
2929
return nil
@@ -40,7 +40,6 @@ func (s *S2K) Parse(parent *result.Item, dumpFlag bool) error {
4040
//0x00: Simple S2K
4141
//0x01: Salted S2K
4242
//0x03: Iterated and Salted S2K
43-
//0x04: Argon2
4443
hashid, err := s.reader.ReadByte()
4544
if err != nil {
4645
return errs.New("invalid hash ID", errs.WithCause(err))
@@ -67,22 +66,22 @@ func (s *S2K) Parse(parent *result.Item, dumpFlag bool) error {
6766
//0x04: Argon2
6867
salt, err := s.reader.ReadBytes(16)
6968
if err != nil {
70-
return errs.New("salt value", errs.WithCause(err))
69+
return errs.New("invalid salt value for Argon2", errs.WithCause(err))
7170
}
7271
itm.Add(values.Salt(salt).ToItem(true))
7372
t, err := s.reader.ReadByte()
7473
if err != nil {
75-
return errs.New("invalid stretch count ID", errs.WithCause(err))
74+
return errs.New("invalid number of passes t for Argon2", errs.WithCause(err))
7675
}
77-
itm.Add(values.Argon2Params(t).ToItem("number of passes t"))
76+
itm.Add(values.Argon2Params(t).ToItem("number of passes t for Argon2"))
7877
p, err := s.reader.ReadByte()
7978
if err != nil {
80-
return errs.New("invalid stretch count ID", errs.WithCause(err))
79+
return errs.New("invalid degree of parallelism p for Argon2", errs.WithCause(err))
8180
}
8281
itm.Add(values.Argon2Params(p).ToItem("degree of parallelism p"))
8382
m, err := s.reader.ReadByte()
8483
if err != nil {
85-
return errs.New("invalid stretch count ID", errs.WithCause(err))
84+
return errs.New("invalid exponent indicating the memory size m for Argon2", errs.WithCause(err))
8685
}
8786
itm.Add(values.Argon2Params(m).ToItem("exponent indicating the memory size m"))
8887
case 101:
@@ -129,7 +128,7 @@ func (s *S2K) Parse(parent *result.Item, dumpFlag bool) error {
129128
return nil
130129
}
131130

132-
//HasIV returns true if it has IV
131+
// HasIV returns true if it has IV
133132
func (s *S2K) HasIV() bool {
134133
return s.hasIV
135134
}

0 commit comments

Comments
 (0)