~john-koepi/ubuntu/trusty/golang/default

« back to all changes in this revision

Viewing changes to src/pkg/crypto/openpgp/read.go

  • Committer: Bazaar Package Importer
  • Author(s): Ondřej Surý
  • Date: 2011-08-03 17:04:59 UTC
  • mfrom: (14.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20110803170459-wzd99m3567y80ila
Tags: 1:59-1
* Imported Upstream version 59
* Refresh patches to a new release
* Fix FTBFS on ARM (Closes: #634270)
* Update version.bash to work with Debian packaging and not hg
  repository

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
        "crypto/openpgp/armor"
11
11
        "crypto/openpgp/error"
12
12
        "crypto/openpgp/packet"
13
 
        "crypto/rsa"
14
13
        _ "crypto/sha256"
15
14
        "hash"
16
15
        "io"
57
56
        // been consumed. Once EOF has been seen, the following fields are
58
57
        // valid. (An authentication code failure is reported as a
59
58
        // SignatureError error when reading from UnverifiedBody.)
60
 
 
61
59
        SignatureError os.Error          // nil if the signature is good.
62
60
        Signature      *packet.Signature // the signature packet itself.
63
61
 
112
110
                case *packet.EncryptedKey:
113
111
                        // This packet contains the decryption key encrypted to a public key.
114
112
                        md.EncryptedToKeyIds = append(md.EncryptedToKeyIds, p.KeyId)
115
 
                        if p.Algo != packet.PubKeyAlgoRSA && p.Algo != packet.PubKeyAlgoRSAEncryptOnly {
 
113
                        switch p.Algo {
 
114
                        case packet.PubKeyAlgoRSA, packet.PubKeyAlgoRSAEncryptOnly, packet.PubKeyAlgoElGamal:
 
115
                                break
 
116
                        default:
116
117
                                continue
117
118
                        }
118
119
                        var keys []Key
155
156
                        }
156
157
                        if !pk.key.PrivateKey.Encrypted {
157
158
                                if len(pk.encryptedKey.Key) == 0 {
158
 
                                        pk.encryptedKey.DecryptRSA(pk.key.PrivateKey.PrivateKey.(*rsa.PrivateKey))
 
159
                                        pk.encryptedKey.Decrypt(pk.key.PrivateKey)
159
160
                                }
160
161
                                if len(pk.encryptedKey.Key) == 0 {
161
162
                                        continue
249
250
                        md.IsSigned = true
250
251
                        md.SignedByKeyId = p.KeyId
251
252
                        keys := keyring.KeysById(p.KeyId)
252
 
                        for _, key := range keys {
 
253
                        for i, key := range keys {
253
254
                                if key.SelfSignature.FlagsValid && !key.SelfSignature.FlagSign {
254
255
                                        continue
255
256
                                }
256
 
                                md.SignedBy = &key
 
257
                                md.SignedBy = &keys[i]
 
258
                                break
257
259
                        }
258
260
                case *packet.LiteralData:
259
261
                        md.LiteralData = p