LEFT | RIGHT |
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 implements parsing and serialization of OpenPGP packets, as | 5 // Package packet implements parsing and serialization of OpenPGP packets, as |
6 // specified in RFC 4880. | 6 // specified in RFC 4880. |
7 package packet | 7 package packet |
8 | 8 |
9 import ( | 9 import ( |
10 "crypto/aes" | 10 "crypto/aes" |
11 "crypto/cast5" | 11 "crypto/cast5" |
12 "crypto/cipher" | 12 "crypto/cipher" |
13 | |
14 error_ "crypto/openpgp/error" | 13 error_ "crypto/openpgp/error" |
15 "io" | 14 "io" |
16 "math/big" | 15 "math/big" |
17 ) | 16 ) |
18 | 17 |
19 // readFull is the same as io.ReadFull except that reading zero bytes returns | 18 // readFull is the same as io.ReadFull except that reading zero bytes returns |
20 // ErrUnexpectedEOF rather than EOF. | 19 // ErrUnexpectedEOF rather than EOF. |
21 func readFull(r io.Reader, buf []byte) (n int, err error) { | 20 func readFull(r io.Reader, buf []byte) (n int, err error) { |
22 n, err = io.ReadFull(r, buf) | 21 n, err = io.ReadFull(r, buf) |
23 if err == io.EOF { | 22 if err == io.EOF { |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 if err == nil { | 473 if err == nil { |
475 _, err = w.Write(mpiBytes) | 474 _, err = w.Write(mpiBytes) |
476 } | 475 } |
477 return | 476 return |
478 } | 477 } |
479 | 478 |
480 // writeBig serializes a *big.Int to w. | 479 // writeBig serializes a *big.Int to w. |
481 func writeBig(w io.Writer, i *big.Int) error { | 480 func writeBig(w io.Writer, i *big.Int) error { |
482 return writeMPI(w, uint16(i.BitLen()), i.Bytes()) | 481 return writeMPI(w, uint16(i.BitLen()), i.Bytes()) |
483 } | 482 } |
LEFT | RIGHT |