func EncryptAndGzip(dstfile, srcfile string, key, iv []byte) { r, _ := os.Open(srcfile, os.O_RDONLY, 0) var w io.WriteCloser w, _ = os.Open(dstfile, os.O_WRONLY|os.O_CREATE, 0666) defer w.Close() w, _ = gzip.NewDeflater(w) defer w.Close() c, _ := aes.NewCipher(key) io.Copy(block.NewCBCEncrypter(c, iv, w), r) }
func EncryptAndGzip(dstfile, srcfile string, key, iv []byte) { r, _ := os.Open(srcfile, os.O_RDONLY, 0) var w io.Writer w, _ = os.Open(dstfile, os.O_WRONLY|os.O_CREATE, 0666) c, _ := aes.NewCipher(key) w = block.NewOFBWriter(c, iv, w) w2, _ := gzip.NewDeflater(w) io.Copy(w2, r) w2.Close() }