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

Delta Between Two Patch Sets: openpgp/packet/symmetric_key_encrypted.go

Issue 5564059: code review 5564059: go.crypto: initial code (Closed)
Left Patch Set: diff -r b50a7fb49394 https://code.google.com/p/go.crypto Created 12 years, 2 months ago
Right Patch Set: diff -r b50a7fb49394 https://code.google.com/p/go.crypto Created 12 years, 2 months 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « openpgp/packet/signature_test.go ('k') | openpgp/packet/symmetric_key_encrypted_test.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
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 "bytes" 8 "bytes"
9 "code.google.com/p/go.crypto/openpgp/errors"
10 "code.google.com/p/go.crypto/openpgp/s2k"
9 "crypto/cipher" 11 "crypto/cipher"
10 "crypto/openpgp/errors"
11 "crypto/openpgp/s2k"
12 "io" 12 "io"
13 "strconv" 13 "strconv"
14 ) 14 )
15 15
16 // This is the largest session key that we'll support. Since no 512-bit cipher 16 // This is the largest session key that we'll support. Since no 512-bit cipher
17 // has even been seriously used, this is comfortably large. 17 // has even been seriously used, this is comfortably large.
18 const maxSessionKeySizeInBytes = 64 18 const maxSessionKeySizeInBytes = 64
19 19
20 // SymmetricKeyEncrypted represents a passphrase protected session key. See RFC 20 // SymmetricKeyEncrypted represents a passphrase protected session key. See RFC
21 // 4880, section 5.3. 21 // 4880, section 5.3.
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 c.XORKeyStream(encryptedCipherAndKey, buf[1:]) 152 c.XORKeyStream(encryptedCipherAndKey, buf[1:])
153 c.XORKeyStream(encryptedCipherAndKey[1:], sessionKey) 153 c.XORKeyStream(encryptedCipherAndKey[1:], sessionKey)
154 _, err = w.Write(encryptedCipherAndKey) 154 _, err = w.Write(encryptedCipherAndKey)
155 if err != nil { 155 if err != nil {
156 return 156 return
157 } 157 }
158 158
159 key = sessionKey 159 key = sessionKey
160 return 160 return
161 } 161 }
LEFTRIGHT

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