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.
15
func EncryptAndGzip(dstfile, srcfile string, key, iv []byte) {
16
r, _ := os.Open(srcfile, os.O_RDONLY, 0)
18
w, _ = os.Open(dstfile, os.O_WRONLY|os.O_CREATE, 0666)
20
w, _ = gzip.NewDeflater(w)
22
c, _ := aes.NewCipher(key)
23
io.Copy(block.NewCBCEncrypter(c, iv, w), r)
27
EncryptAndGzip("/tmp/passwd.gz", "/etc/passwd", make([]byte, 16), make([]byte, 16))