OLD | NEW |
1 // Copyright 2010 The Go Authors. All rights reserved. | 1 // Copyright 2010 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 armor implements OpenPGP ASCII Armor, see RFC 4880. OpenPGP Armor is | 5 // Package armor implements OpenPGP ASCII Armor, see RFC 4880. OpenPGP Armor is |
6 // very similar to PEM except that it has an additional CRC checksum. | 6 // very similar to PEM except that it has an additional CRC checksum. |
7 package armor | 7 package armor |
8 | 8 |
9 import ( | 9 import ( |
10 "bufio" | 10 "bufio" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 return | 104 return |
105 } | 105 } |
106 if !bytes.HasPrefix(line, armorEnd) { | 106 if !bytes.HasPrefix(line, armorEnd) { |
107 return 0, ArmorCorrupt | 107 return 0, ArmorCorrupt |
108 } | 108 } |
109 | 109 |
110 l.eof = true | 110 l.eof = true |
111 return 0, io.EOF | 111 return 0, io.EOF |
112 } | 112 } |
113 | 113 |
114 » if len(line) > 64 { | 114 » if len(line) > 96 { |
115 return 0, ArmorCorrupt | 115 return 0, ArmorCorrupt |
116 } | 116 } |
117 | 117 |
118 n = copy(p, line) | 118 n = copy(p, line) |
119 bytesToSave := len(line) - n | 119 bytesToSave := len(line) - n |
120 if bytesToSave > 0 { | 120 if bytesToSave > 0 { |
121 if cap(l.buf) < bytesToSave { | 121 if cap(l.buf) < bytesToSave { |
122 l.buf = make([]byte, 0, bytesToSave) | 122 l.buf = make([]byte, 0, bytesToSave) |
123 } | 123 } |
124 l.buf = l.buf[0:bytesToSave] | 124 l.buf = l.buf[0:bytesToSave] |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 } | 210 } |
211 | 211 |
212 p.lReader.in = r | 212 p.lReader.in = r |
213 p.oReader.currentCRC = crc24Init | 213 p.oReader.currentCRC = crc24Init |
214 p.oReader.lReader = &p.lReader | 214 p.oReader.lReader = &p.lReader |
215 p.oReader.b64Reader = base64.NewDecoder(base64.StdEncoding, &p.lReader) | 215 p.oReader.b64Reader = base64.NewDecoder(base64.StdEncoding, &p.lReader) |
216 p.Body = &p.oReader | 216 p.Body = &p.oReader |
217 | 217 |
218 return | 218 return |
219 } | 219 } |
OLD | NEW |