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 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 "code.google.com/p/go.crypto/cast5" | 10 "code.google.com/p/go.crypto/cast5" |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 m, err = r.Read(buf[:]) | 265 m, err = r.Read(buf[:]) |
266 n += int64(m) | 266 n += int64(m) |
267 if err == io.EOF { | 267 if err == io.EOF { |
268 err = nil | 268 err = nil |
269 return | 269 return |
270 } | 270 } |
271 if err != nil { | 271 if err != nil { |
272 return | 272 return |
273 } | 273 } |
274 } | 274 } |
| 275 |
| 276 panic("unreachable") |
275 } | 277 } |
276 | 278 |
277 // packetType represents the numeric ids of the different OpenPGP packet types.
See | 279 // packetType represents the numeric ids of the different OpenPGP packet types.
See |
278 // http://www.iana.org/assignments/pgp-parameters/pgp-parameters.xhtml#pgp-param
eters-2 | 280 // http://www.iana.org/assignments/pgp-parameters/pgp-parameters.xhtml#pgp-param
eters-2 |
279 type packetType uint8 | 281 type packetType uint8 |
280 | 282 |
281 const ( | 283 const ( |
282 packetTypeEncryptedKey packetType = 1 | 284 packetTypeEncryptedKey packetType = 1 |
283 packetTypeSignature packetType = 2 | 285 packetTypeSignature packetType = 2 |
284 packetTypeSymmetricKeyEncrypted packetType = 3 | 286 packetTypeSymmetricKeyEncrypted packetType = 3 |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 if err == nil { | 481 if err == nil { |
480 _, err = w.Write(mpiBytes) | 482 _, err = w.Write(mpiBytes) |
481 } | 483 } |
482 return | 484 return |
483 } | 485 } |
484 | 486 |
485 // writeBig serializes a *big.Int to w. | 487 // writeBig serializes a *big.Int to w. |
486 func writeBig(w io.Writer, i *big.Int) error { | 488 func writeBig(w io.Writer, i *big.Int) error { |
487 return writeMPI(w, uint16(i.BitLen()), i.Bytes()) | 489 return writeMPI(w, uint16(i.BitLen()), i.Bytes()) |
488 } | 490 } |
LEFT | RIGHT |