Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(78)

Delta Between Two Patch Sets: src/pkg/crypto/openpgp/packet/public_key.go

Issue 3989052: code review 3989052: crypto/openpgp: add package. (Closed)
Left Patch Set: code review 3989052: crypto/openpgp: API pre-review Created 14 years, 1 month ago
Right Patch Set: diff -r a2846f4a9040 https://go.googlecode.com/hg/ Created 14 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/crypto/openpgp/packet/packet.go ('k') | src/pkg/crypto/openpgp/read.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(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/dsa" 9 "crypto/dsa"
10 "crypto/openpgp/error" 10 "crypto/openpgp/error"
11 "crypto/rsa" 11 "crypto/rsa"
12 "crypto/sha1" 12 "crypto/sha1"
13 "encoding/binary" 13 "encoding/binary"
14 "hash" 14 "hash"
15 "io" 15 "io"
16 "os" 16 "os"
17 ) 17 )
18 18
19 // PublicKey represents an OpenPGP public key. See RFC 4880, section 5.5.2. 19 // PublicKey represents an OpenPGP public key. See RFC 4880, section 5.5.2.
20 type PublicKey struct { 20 type PublicKey struct {
21 CreationTime uint32 // seconds since the epoch 21 CreationTime uint32 // seconds since the epoch
22 PubKeyAlgo PublicKeyAlgorithm 22 PubKeyAlgo PublicKeyAlgorithm
23 PublicKey interface{} // Either a *rsa.PublicKey or *dsa.PublicKey 23 PublicKey interface{} // Either a *rsa.PublicKey or *dsa.PublicKey
24 Fingerprint [20]byte 24 Fingerprint [20]byte
25 KeyId uint64 25 KeyId uint64
26 » IsSubKey bool 26 » IsSubkey bool
27 27
28 n, e, p, q, g, y parsedMPI 28 n, e, p, q, g, y parsedMPI
29 } 29 }
30 30
31 func (pk *PublicKey) parse(r io.Reader) (err os.Error) { 31 func (pk *PublicKey) parse(r io.Reader) (err os.Error) {
32 // RFC 4880, section 5.5.2 32 // RFC 4880, section 5.5.2
33 var buf [6]byte 33 var buf [6]byte
34 _, err = readFull(r, buf[:]) 34 _, err = readFull(r, buf[:])
35 if err != nil { 35 if err != nil {
36 return 36 return
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 // given Writer. 251 // given Writer.
252 func writeMPIs(w io.Writer, mpis ...parsedMPI) (err os.Error) { 252 func writeMPIs(w io.Writer, mpis ...parsedMPI) (err os.Error) {
253 for _, mpi := range mpis { 253 for _, mpi := range mpis {
254 err = writeMPI(w, mpi.bitLength, mpi.bytes) 254 err = writeMPI(w, mpi.bitLength, mpi.bytes)
255 if err != nil { 255 if err != nil {
256 return 256 return
257 } 257 }
258 } 258 }
259 return 259 return
260 } 260 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b