Skip to content

Commit

Permalink
Remove Name field from profile (#305)
Browse files Browse the repository at this point in the history
* feat: Remove Name field from profile

* ci: Update interop-test-docker to v1.1.12
  • Loading branch information
lubux authored Nov 6, 2024
1 parent c664aa9 commit 87b5974
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/sop-test-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
name: Run interoperability test suite
runs-on: ubuntu-latest
container:
image: ghcr.io/protonmail/openpgp-interop-test-docker:v1.1.9
image: ghcr.io/protonmail/openpgp-interop-test-docker:v1.1.12
credentials:
username: ${{ github.actor }}
password: ${{ secrets.github_token }}
Expand Down
3 changes: 2 additions & 1 deletion crypto/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const testMessage = "Hello world!"

var testPGP *PGPHandle
var testProfiles []*profile.Custom
var testProfileNames []string

func readTestFile(name string, trimNewlines bool) string {
data, err := os.ReadFile("testdata/" + name) //nolint
Expand All @@ -35,7 +36,7 @@ func init() {
testPGP = PGP()
testPGP.defaultTime = NewConstantClock(testTime) // 2019-05-13T13:37:07+00:00
testProfiles = []*profile.Custom{profile.Default(), profile.RFC4880(), profile.RFC9580()}

testProfileNames = []string{"Default", "RFC4880", "RFC9580"}
initEncDecTest()
initGenerateKeys()
initArmoredKeys()
Expand Down
8 changes: 4 additions & 4 deletions crypto/encrypt_decrypt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var password = []byte("password")
var decPasswords = [][]byte{[]byte("wrongPassword"), password}
var testMaterialForProfiles []*testMaterial

func generateTestKeyMaterial(profile *profile.Custom) *testMaterial {
func generateTestKeyMaterial(name string, profile *profile.Custom) *testMaterial {
handle := PGPWithProfile(profile)
testSessionKey, err := handle.GenerateSessionKey()
if err != nil {
Expand Down Expand Up @@ -57,7 +57,7 @@ func generateTestKeyMaterial(profile *profile.Custom) *testMaterial {
panic("Cannot generate key:" + err.Error())
}
return &testMaterial{
profileName: profile.Name,
profileName: name,
pgp: handle,
keyRingTestPublic: keyRingTestPublic,
keyRingTestPrivate: keyRingTestPrivate,
Expand All @@ -67,8 +67,8 @@ func generateTestKeyMaterial(profile *profile.Custom) *testMaterial {
}

func initEncDecTest() {
for _, profile := range testProfiles {
material := generateTestKeyMaterial(profile)
for ind, profile := range testProfiles {
material := generateTestKeyMaterial(testProfileNames[ind], profile)
testMaterialForProfiles = append(testMaterialForProfiles, material)
}
if len(testMaterialForProfiles) < 2 {
Expand Down
3 changes: 0 additions & 3 deletions profile/preset.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ func Default() *Custom {
}
}
return &Custom{
Name: "default",
SetKeyAlgorithm: setKeyAlgorithm,
Hash: crypto.SHA256,
CipherEncryption: packet.CipherAES256,
Expand All @@ -45,7 +44,6 @@ func RFC4880() *Custom {
}
}
return &Custom{
Name: "rfc4880",
SetKeyAlgorithm: setKeyAlgorithm,
Hash: crypto.SHA256,
CipherEncryption: packet.CipherAES256,
Expand All @@ -65,7 +63,6 @@ func RFC9580() *Custom {
}
}
return &Custom{
Name: "rfc9580",
SetKeyAlgorithm: setKeyAlgorithm,
Hash: crypto.SHA512,
CipherEncryption: packet.CipherAES256,
Expand Down
2 changes: 0 additions & 2 deletions profile/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ const weakMinRSABits = 1023
// Use one of the pre-defined profiles if possible.
// i.e., profile.Default(), profile.RFC4880().
type Custom struct {
// Name defines the name of the custom profile.
Name string
// SetKeyAlgorithm is a function that sets public key encryption
// algorithm in the config bases on the int8 security level.
SetKeyAlgorithm func(*packet.Config, int8)
Expand Down

0 comments on commit 87b5974

Please sign in to comment.