Skip to content

Commit fff8534

Browse files
Fix ECC secret key information
1 parent 662972b commit fff8534

File tree

5 files changed

+14
-27
lines changed

5 files changed

+14
-27
lines changed

packet/pubkey/parse_secplain.go

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,7 @@ func (p *Pubkey) ecdhSec(item *info.Item) error {
104104
if err != nil || mpi == nil {
105105
return err
106106
}
107-
switch (mpi.Rawdata())[0] {
108-
case 0x04:
109-
item.Add(mpi.ToItem("ECDH EC point (04 || X || Y)", p.cxt.Integer()))
110-
case 0x40:
111-
item.Add(mpi.ToItem("ECDH EC point (40 || X)", p.cxt.Integer()))
112-
default:
113-
item.Add(mpi.ToItem("ECDH EC point", p.cxt.Integer()))
114-
}
107+
item.Add(mpi.ToItem("ECDH secret key", p.cxt.Integer()))
115108
return nil
116109
}
117110

@@ -120,14 +113,7 @@ func (p *Pubkey) ecdsaSec(item *info.Item) error {
120113
if err != nil || mpi == nil {
121114
return err
122115
}
123-
switch (mpi.Rawdata())[0] {
124-
case 0x04:
125-
item.Add(mpi.ToItem("ECDSA EC point (04 || X || Y)", p.cxt.Integer()))
126-
case 0x40:
127-
item.Add(mpi.ToItem("ECDSA EC point (40 || X)", p.cxt.Integer()))
128-
default:
129-
item.Add(mpi.ToItem("ECDSA EC point", p.cxt.Integer()))
130-
}
116+
item.Add(mpi.ToItem("ECDSA secret key", p.cxt.Integer()))
131117
return nil
132118
}
133119

@@ -136,14 +122,7 @@ func (p *Pubkey) eddsaSec(item *info.Item) error {
136122
if err != nil || mpi == nil {
137123
return err
138124
}
139-
switch (mpi.Rawdata())[0] {
140-
case 0x04:
141-
item.Add(mpi.ToItem("EdDSA EC point (04 || uncompressd format)", p.cxt.Integer()))
142-
case 0x40:
143-
item.Add(mpi.ToItem("EdDSA EC point (40 || compressd format)", p.cxt.Integer()))
144-
default:
145-
item.Add(mpi.ToItem("EdDSA EC point", p.cxt.Integer()))
146-
}
125+
item.Add(mpi.ToItem("EdDSA secret key", p.cxt.Integer()))
147126
return nil
148127
}
149128

packet/pubkey/parse_secplain_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const (
2929
7f 2a
3030
`
3131
secPlainResult22 = `
32-
EdDSA EC point (255 bits)
32+
EdDSA secret key (255 bits)
3333
50 5e cc 13 31 23 59 49 c2 cc 48 1d 7c e8 39 85 ac 36 2f 76 ff 5a e5 d6 09 68 c6 e7 de cb 00 5c
3434
Checksum
3535
10 55

packet/pubkey/parse_sig_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212

1313
var (
1414
pubkeySig19 = []byte{0x01, 0x00, 0xea, 0x1d, 0xa2, 0x14, 0x5b, 0x82, 0x06, 0xfd, 0xd5, 0xae, 0xc4, 0x9f, 0xd8, 0x14, 0x44, 0x41, 0xa4, 0xf5, 0x4f, 0x56, 0x69, 0xad, 0x9a, 0xb0, 0x44, 0xf3, 0xa3, 0x88, 0xb2, 0x60, 0xf4, 0x0c, 0x00, 0xfc, 0x0a, 0xd3, 0xc0, 0x23, 0xf3, 0xed, 0xcd, 0xaf, 0x9b, 0x19, 0x6f, 0xee, 0xc4, 0x65, 0x44, 0xb5, 0x08, 0xe8, 0x27, 0x6c, 0x3a, 0xa8, 0x6e, 0x3b, 0x52, 0x9f, 0x61, 0x7a, 0xea, 0xee, 0x27, 0x48}
15+
pubkeySig22 = []byte{0x00, 0xfd, 0x17, 0xe2, 0xb2, 0xa9, 0xa4, 0xdd, 0x49, 0x9c, 0x67, 0xe8, 0xa2, 0x9d, 0x82, 0xb7, 0x0e, 0x8a, 0xe9, 0xee, 0xc4, 0x0d, 0x69, 0x67, 0xf6, 0xcf, 0xd9, 0x36, 0x01, 0x58, 0xb5, 0xe8, 0x8a, 0xb4, 0x00, 0xfb, 0x04, 0xe6, 0xf4, 0xad, 0x9a, 0x49, 0xcf, 0x58, 0xba, 0x56, 0xc9, 0x70, 0x51, 0x77, 0x5c, 0xa4, 0x09, 0x0f, 0x3b, 0xca, 0x78, 0x3c, 0xa4, 0x9e, 0x89, 0x3e, 0x4d, 0x5c, 0xd8, 0x21, 0x53, 0x08}
1516
pubkeySigUnknown = []byte{0x01, 0x02, 0x03, 0x04}
1617
)
1718

@@ -21,6 +22,12 @@ const (
2122
ea 1d a2 14 5b 82 06 fd d5 ae c4 9f d8 14 44 41 a4 f5 4f 56 69 ad 9a b0 44 f3 a3 88 b2 60 f4 0c
2223
ECDSA value s (252 bits)
2324
0a d3 c0 23 f3 ed cd af 9b 19 6f ee c4 65 44 b5 08 e8 27 6c 3a a8 6e 3b 52 9f 61 7a ea ee 27 48
25+
`
26+
pubkeySigResult22 = `
27+
EdDSA compressed value r (253 bits)
28+
17 e2 b2 a9 a4 dd 49 9c 67 e8 a2 9d 82 b7 0e 8a e9 ee c4 0d 69 67 f6 cf d9 36 01 58 b5 e8 8a b4
29+
EdDSA compressed value s (251 bits)
30+
04 e6 f4 ad 9a 49 cf 58 ba 56 c9 70 51 77 5c a4 09 0f 3b ca 78 3c a4 9e 89 3e 4d 5c d8 21 53 08
2431
`
2532
pubkeySigResultUnknown = `
2633
Multi-precision integers of Unknown (pub 99) (4 bytes)
@@ -35,6 +42,7 @@ func TestPubkeySig(t *testing.T) {
3542
res string
3643
}{
3744
{pubID: 19, content: pubkeySig19, res: pubkeySigResult19},
45+
{pubID: 22, content: pubkeySig22, res: pubkeySigResult22},
3846
{pubID: 99, content: pubkeySigUnknown, res: pubkeySigResultUnknown},
3947
}
4048
for _, tc := range testCases {

packet/tags/tag05_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ const (
8484
EdDSA EC point (40 || compressd format) (263 bits)
8585
40 c6 ae d8 56 62 34 73 e7 f1 86 ff 5f 09 dd d2 c2 b5 48 bd 78 94 90 a8 d2 fd 9c fc c6 69 15 fb 86
8686
Secret-Key (the secret-key data is not encrypted.)
87-
EdDSA EC point (255 bits)
87+
EdDSA secret key (255 bits)
8888
50 5e cc 13 31 23 59 49 c2 cc 48 1d 7c e8 39 85 ac 36 2f 76 ff 5a e5 d6 09 68 c6 e7 de cb 00 5c
8989
Checksum
9090
10 55

packet/tags/tag07_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const (
3636
Symmetric Algorithm: AES with 256-bit key (sym 9)
3737
09
3838
Secret-Key (the secret-key data is not encrypted.)
39-
ECDH EC point (255 bits)
39+
ECDH secret key (255 bits)
4040
78 d6 1d 85 a4 dd 46 38 2f d6 aa 70 7c 09 8f d5 5d 2b 1a e3 3f 9b 28 c9 4c 75 51 ec bf e1 d5 18
4141
Checksum
4242
10 d1

0 commit comments

Comments
 (0)