1
// Copyright 2010 The Go Authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style
3
// license that can be found in the LICENSE file.
5
// This code differs from the slides in that it handles errors.
18
func EncryptAndGzip(dstfile, srcfile string, key, iv []byte) error {
19
r, err := os.Open(srcfile)
24
w, err = os.Create(dstfile)
29
w, err = gzip.NewWriter(w)
34
c, err := aes.NewCipher(key)
38
_, err = io.Copy(cipher.StreamWriter{S: cipher.NewOFB(c, iv), W: w}, r)
43
err := EncryptAndGzip(