LEFT | RIGHT |
(no file at all) | |
1 // Copyright 2011 The Go Authors. All rights reserved. | 1 // Copyright 2011 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 package packet | 5 package packet |
6 | 6 |
7 import ( | 7 import ( |
8 "big" | 8 "big" |
9 "crypto" | 9 "crypto" |
10 "crypto/dsa" | 10 "crypto/dsa" |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 | 386 |
387 var ok bool | 387 var ok bool |
388 l := 6 + hashedSubpacketsLen | 388 l := 6 + hashedSubpacketsLen |
389 sig.HashSuffix = make([]byte, l+6) | 389 sig.HashSuffix = make([]byte, l+6) |
390 sig.HashSuffix[0] = 4 | 390 sig.HashSuffix[0] = 4 |
391 sig.HashSuffix[1] = uint8(sig.SigType) | 391 sig.HashSuffix[1] = uint8(sig.SigType) |
392 sig.HashSuffix[2] = uint8(sig.PubKeyAlgo) | 392 sig.HashSuffix[2] = uint8(sig.PubKeyAlgo) |
393 sig.HashSuffix[3], ok = s2k.HashToHashId(sig.Hash) | 393 sig.HashSuffix[3], ok = s2k.HashToHashId(sig.Hash) |
394 if !ok { | 394 if !ok { |
395 sig.HashSuffix = nil | 395 sig.HashSuffix = nil |
396 » » return error.InvalidArgumentError("hash cannot be repesented in
OpenPGP: " + strconv.Itoa(int(sig.Hash))) | 396 » » return error.InvalidArgumentError("hash cannot be represented in
OpenPGP: " + strconv.Itoa(int(sig.Hash))) |
397 } | 397 } |
398 sig.HashSuffix[4] = byte(hashedSubpacketsLen >> 8) | 398 sig.HashSuffix[4] = byte(hashedSubpacketsLen >> 8) |
399 sig.HashSuffix[5] = byte(hashedSubpacketsLen) | 399 sig.HashSuffix[5] = byte(hashedSubpacketsLen) |
400 serializeSubpackets(sig.HashSuffix[6:l], sig.outSubpackets, true) | 400 serializeSubpackets(sig.HashSuffix[6:l], sig.outSubpackets, true) |
401 trailer := sig.HashSuffix[l:] | 401 trailer := sig.HashSuffix[l:] |
402 trailer[0] = 4 | 402 trailer[0] = 4 |
403 trailer[1] = 0xff | 403 trailer[1] = 0xff |
404 trailer[2] = byte(l >> 24) | 404 trailer[2] = byte(l >> 24) |
405 trailer[3] = byte(l >> 16) | 405 trailer[3] = byte(l >> 16) |
406 trailer[4] = byte(l >> 8) | 406 trailer[4] = byte(l >> 8) |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 subpackets = append(subpackets, outputSubpacket{true, creationTimeSubpac
ket, creationTime}) | 519 subpackets = append(subpackets, outputSubpacket{true, creationTimeSubpac
ket, creationTime}) |
520 | 520 |
521 if sig.IssuerKeyId != nil { | 521 if sig.IssuerKeyId != nil { |
522 keyId := make([]byte, 8) | 522 keyId := make([]byte, 8) |
523 binary.BigEndian.PutUint64(keyId, *sig.IssuerKeyId) | 523 binary.BigEndian.PutUint64(keyId, *sig.IssuerKeyId) |
524 subpackets = append(subpackets, outputSubpacket{true, issuerSubp
acket, keyId}) | 524 subpackets = append(subpackets, outputSubpacket{true, issuerSubp
acket, keyId}) |
525 } | 525 } |
526 | 526 |
527 return | 527 return |
528 } | 528 } |
LEFT | RIGHT |