/
aes256ofb.go
39 lines (31 loc) · 1.05 KB
/
aes256ofb.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package fortifier
import (
"crypto/cipher"
"io"
"os"
)
type Aes256EncrypterOFB struct {
Aes256StreamEncrypter
}
func NewAes256EncrypterOFB(f *Fortifier) *Aes256EncrypterOFB {
return &Aes256EncrypterOFB{Aes256StreamEncrypter{f}}
}
func (f *Aes256EncrypterOFB) EncryptFile(in, out *os.File) error {
f.meta.Mode = CipherModeAes256OFB
return f.Aes256StreamEncrypter.EncryptFile(in, out,
CipherMode{Name: CipherModeAes256OFB, SteamMaker: cipher.NewOFB})
}
type Aes256DecrypterOFB struct {
Aes256StreamDecrypter
}
func NewAes256DecrypterOFB(f *Fortifier) *Aes256DecrypterOFB {
return &Aes256DecrypterOFB{Aes256StreamDecrypter{f}}
}
func (f *Aes256DecrypterOFB) Decrypt(r io.Reader, w io.Writer, layout *FileLayout) error {
return f.Aes256StreamDecrypter.Decrypt(r, w, layout,
CipherMode{Name: CipherModeAes256OFB, SteamMaker: cipher.NewOFB})
}
func (f *Aes256DecrypterOFB) DecryptFile(in, out *os.File, layout *FileLayout) error {
return f.Aes256StreamDecrypter.DecryptFile(in, out, layout,
CipherMode{Name: CipherModeAes256OFB, SteamMaker: cipher.NewOFB})
}