1 diff -r 7ec969250bfc src/pkg/crypto/openpgp/packet/signature.go
2 --- a/src/pkg/crypto/openpgp/packet/signature.go Tue Dec 27 09:49:19 2011 -0500
3 +++ b/src/pkg/crypto/openpgp/packet/signature.go Fri Dec 30 22:56:55 2011 +0100
6 creationTimeSubpacket signatureSubpacketType = 2
7 signatureExpirationSubpacket signatureSubpacketType = 3
8 - keyExpirySubpacket signatureSubpacketType = 9
9 + keyExpirationSubpacket signatureSubpacketType = 9
10 prefSymmetricAlgosSubpacket signatureSubpacketType = 11
11 issuerSubpacket signatureSubpacketType = 16
12 prefHashAlgosSubpacket signatureSubpacketType = 21
16 t := binary.BigEndian.Uint32(subpacket)
18 - sig.CreationTime = time.Time{}
20 - sig.CreationTime = time.Unix(int64(t), 0)
22 + sig.CreationTime = time.Unix(int64(t), 0)
23 case signatureExpirationSubpacket:
24 // Signature expiration time, section 5.2.3.10
28 sig.SigLifetimeSecs = new(uint32)
29 *sig.SigLifetimeSecs = binary.BigEndian.Uint32(subpacket)
30 - case keyExpirySubpacket:
31 + case keyExpirationSubpacket:
32 // Key expiration time, section 5.2.3.6
36 subpackets = append(subpackets, outputSubpacket{true, issuerSubpacket, false, keyId})
39 + if sig.SigLifetimeSecs != nil && *sig.SigLifetimeSecs != 0 {
40 + sigLifetime := make([]byte, 4)
41 + binary.BigEndian.PutUint32(sigLifetime, *sig.SigLifetimeSecs)
42 + // signature expiration is marked as critical
43 + subpackets = append(subpackets, outputSubpacket{true, signatureExpirationSubpacket, true, sigLifetime})
46 + // The following subpackets may only appear in self-signatures
48 + if sig.KeyLifetimeSecs != nil && *sig.KeyLifetimeSecs != 0 {
49 + keyLifetime := make([]byte, 4)
50 + binary.BigEndian.PutUint32(keyLifetime, *sig.KeyLifetimeSecs)
52 + // key expiration is marked as critical
53 + subpackets = append(subpackets, outputSubpacket{true, keyExpirationSubpacket, true, keyLifetime})
56 + if sig.IsPrimaryId != nil && *sig.IsPrimaryId {
57 + subpackets = append(subpackets, outputSubpacket{true, primaryUserIdSubpacket, false, []byte{1}})
60 + // []byte slices of preferred algorithms are not copied
62 + if len(sig.PreferredSymmetric) > 0 {
63 + subpackets = append(subpackets, outputSubpacket{true, prefSymmetricAlgosSubpacket, false, sig.PreferredSymmetric})
66 + if len(sig.PreferredHash) > 0 {
67 + subpackets = append(subpackets, outputSubpacket{true, prefHashAlgosSubpacket, false, sig.PreferredHash})
70 + if len(sig.PreferredCompression) > 0 {
71 + subpackets = append(subpackets, outputSubpacket{true, prefCompressionSubpacket, false, sig.PreferredCompression})
74 + // The Key Flags subpacket may only appear in self-signatures or certification signatures
78 + if sig.FlagCertify {
84 + if sig.FlagEncryptCommunications {
87 + if sig.FlagEncryptStorage {
90 + subpackets = append(subpackets, outputSubpacket{true, keyFlagsSubpacket, false, []byte{flags}})