Skip to content

Commit 7b0d662

Browse files
Add subpacket 34 (Preferred AEAD Algorithms)
1 parent d180264 commit 7b0d662

File tree

4 files changed

+41
-1
lines changed

4 files changed

+41
-1
lines changed

packet/tags/sub34.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package tags
2+
3+
import (
4+
"github.com/spiegel-im-spiegel/gpgpdump/info"
5+
"github.com/spiegel-im-spiegel/gpgpdump/packet/context"
6+
"github.com/spiegel-im-spiegel/gpgpdump/packet/reader"
7+
"github.com/spiegel-im-spiegel/gpgpdump/packet/values"
8+
)
9+
10+
//subReserved class for Reserved Sub-packet
11+
type sub34 subInfo
12+
13+
//newSubReserved return subReserved instance
14+
func newSub34(cxt *context.Context, subID values.SuboacketID, body []byte) Subs {
15+
return &sub34{cxt: cxt, subID: subID, reader: reader.New(body)}
16+
}
17+
18+
// Parse parsing Reserved Sub-packet
19+
func (s *sub34) Parse() (*info.Item, error) {
20+
rootInfo := s.subID.ToItem(s.reader, s.cxt.Debug())
21+
return rootInfo, nil
22+
}
23+
24+
/* Copyright 2016 Spiegel
25+
*
26+
* Licensed under the Apache License, Version 2.0 (the "License");
27+
* you may not use this file except in compliance with the License.
28+
* You may obtain a copy of the License at
29+
*
30+
* http://www.apache.org/licenses/LICENSE-2.0
31+
*
32+
* Unless required by applicable law or agreed to in writing, software
33+
* distributed under the License is distributed on an "AS IS" BASIS,
34+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
35+
* See the License for the specific language governing permissions and
36+
* limitations under the License.
37+
*/

packet/tags/subs.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ var newFunctionsSub02 = SubFuncMap{
5959
30: newSub30, //Features
6060
31: newSub31, //Signature Target
6161
33: newSub33, //Issuer Fingerprint
62+
34: newSub34, //Preferred AEAD Algorithms
6263
}
6364

6465
var newFunctionsSub17 = SubFuncMap{

packet/values/subpacketid.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ var subpacketNames = Msgs{
4242
31: "Signature Target", //31
4343
32: "Embedded Signature", //32
4444
33: "Issuer Fingerprint", //33
45+
34: "Preferred AEAD Algorithms", //34
4546
}
4647

4748
//SuboacketID is sub-packet type ID

packet/values/subpacketid_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ var testSubpacketNames = []string{
4242
"Signature Target (sub 31)", //31
4343
"Embedded Signature (sub 32)", //32
4444
"Issuer Fingerprint (sub 33)", //33
45-
"Unknown (sub 34)", //34
45+
"Preferred AEAD Algorithms (sub 34)", //34
46+
"Unknown (sub 35)", //35
4647
}
4748

4849
func TestSubpacketID(t *testing.T) {

0 commit comments

Comments
 (0)