Documentation ¶
Index ¶
- Constants
- func NewHdrEncrypt(Version, Fctype, Blocksize int) (fileCryptEnc, error)
- func NewHdrKey(KeyIn []byte, params ...int) (fileCryptKey, error)
- type ClearFc
- type DirectKeyFc
- type FileCrypt
- func (fc *FileCrypt) AddBlock(tag []byte, encType int, cleartext interface{}) error
- func (fc FileCrypt) DecryptAll(keyIn []byte) ([]interface{}, error)
- func (fc FileCrypt) DecryptSingle(tag []byte, keyIn []byte) (interface{}, error)
- func (fc FileCrypt) HMACRead() ([]byte, error)
- func (fc FileCrypt) ListTags() [][]byte
- func (fc FileCrypt) NBlocks() int
- func (fc *FileCrypt) Nonce() []byte
- type GcmFc
- type NoKeyFc
- type Pbkdf2Fc
- type RsaFc
Constants ¶
View Source
const ( FC_DIRECTKEYHDR_END_OFFSET = 2 FC_DIRECTKEYHDR_NPARMS = 2 )
Hdr format
View Source
const ( FC_NOHASH = iota FC_HASH_SHA256 FC_NHASH )
Hash Functions
View Source
const ( FC_HDR_REG_VERSION_SIZE = 1 FC_HDR_REG_SEALT_SIZE = 1 FC_HDR_REG_NBLOCKS_SIZE = 8 FC_HDR_REG_NONCE_SIZE = FC_SEAL_SALTLEN FC_HDR_REG_BOFFSET_SIZE = 8 FC_HDR_REG_BTAG_SIZE = 9 FC_HDR_REG_VERSION_OFFSET = 0 FC_HDR_REG_SEALT_OFFSET = FC_HDR_REG_VERSION_SIZE FC_HDR_REG_NBLOCKS_OFFSET = FC_HDR_REG_SEALT_OFFSET + FC_HDR_REG_SEALT_SIZE FC_HDR_REG_NONCE_OFFSET = FC_HDR_REG_NBLOCKS_OFFSET + FC_HDR_REG_NBLOCKS_SIZE FC_HDR_REG_BDATA_OFFSET = FC_HDR_REG_NONCE_OFFSET + FC_HDR_REG_NONCE_SIZE FC_HDR_REG_BOFFSET_OFFSET = 0 FC_HDR_REG_BTAG_OFFSET = FC_HDR_REG_BOFFSET_SIZE FC_HDR_REG_END_OFFSET = FC_HDR_REG_BTAG_OFFSET + FC_HDR_REG_BTAG_SIZE )
Offset and Sizes
View Source
const ( MODE_INIT = iota MODE_MODIFY )
View Source
const ( FC_HDR_VERSION_1 = iota FC_HDR_NVERSION )
Version (Backwards interop)
View Source
const ( FC_SEAL_SALTLEN = 16 FC_SEAL_NITER = 80000 FC_SEAL_KLEN = FC_BSIZE_BYTES_256 FC_SEAL_LEN = FC_BSIZE_BYTES_256 )
View Source
const ( FC_CLEAR = iota // No encryption FC_GCM // GCM FC_RSA FC_NTYPE )
Filecrypt supported encryption schemes
View Source
const ( FC_BSIZE_BYTES_128 = 16 FC_BSIZE_BYTES_256 = 32 FC_BSIZE_BYTES_2048 = 256 FC_BSIZE_BYTES_4096 = 512 )
Supported encryption block sizes in bytes
View Source
const ( FC_HDRE_VERSION_1 = iota FC_HDRE_NVERSION )
Version (Backwards interop)
View Source
const ( FC_HDR_BSIZE_128 = iota FC_HDR_BSIZE_256 FC_HDR_BSIZE_2048 FC_HDR_BSIZE_4096 FC_HDR_NBSIZE )
block size
View Source
const ( FC_HDR_VERSION_OFFSET = 0 FC_HDR_FCTYPE_OFFSET = 1 FC_HDR_BSIZE_OFFSET = 2 FC_HDR_NONCESIZE_OFFSET = 3 FC_HDR_LAST_BLOCKSIZE_OFFSET = 4 FC_HDR_NBLOCKS_OFFSET = 5 FC_HDR_END_OFFSET = 13 )
Hdr format
View Source
const ( FC_KEY_T_NOKEY = iota // no Key FC_KEY_T_DIRECT // DIRECT FC_KEY_T_PBKDF2 // PBKDF2 FC_KEY_NTYPE )
KDF Supported Types
View Source
const ( FC_HDRK_VERSION_1 = iota FC_HDREK_NVERSION )
Version (Backwards interop)
View Source
const ( FC_NOKEYHDR_END_OFFSET = 2 FC_NOKEYHDR_NPARAMS = 2 )
Hdr format
View Source
const ( FC_PBKDF2HDR_MAXITER = 100000 FC_PBKDF2HDR_SALT_MAXLEN = 128 FC_PBKDF2HDR_OUT_MAXLEN = 128 FC_PBKDF2HDR_MINPARAMS = 2 FC_PBKDF2HDR_MAXPARAMS = 6 )
View Source
const ( FC_PBKDF2HDR_LEN_OFFSET = 2 FC_PBKDF2HDR_HASH_OFFSET = 3 FC_PBKDF2HDR_ITER_OFFSET = 4 FC_PBKDF2HDR_OUTLEN_OFFSET = 8 FC_PBKDF2HDR_SALTLEN_OFFSET = 9 FC_PBKDF2HDR_SALT_OFFSET = 10 )
Hdr format
View Source
const ( FC_PBKDF2HDR_DEF_HASH = FC_HASH_SHA256 FC_PBKDF2HDR_DEF_NITER = 60000 FC_PBKDF2HDR_DEF_OUTLEN = FC_BSIZE_BYTES_256 FC_PBKDF2HDR_DEF_SALTLEN = 12 )
View Source
const (
FC_HDRE_DEF_VERSION = FC_HDRE_VERSION_1
)
View Source
const (
FC_HDRK_DEF_VERSION = FC_HDRK_VERSION_1
)
View Source
const (
FC_HDR_DEF_VERSION = FC_HDR_VERSION_1
)
Variables ¶
This section is empty.
Functions ¶
func NewHdrEncrypt ¶
Types ¶
type DirectKeyFc ¶
type DirectKeyFc struct {
// contains filtered or unexported fields
}
type FileCrypt ¶
type FileCrypt struct {
// contains filtered or unexported fields
}
func New ¶
func New(nBlocks int, fname string, hmacKey, fcKey []byte, fcKType int, params ...int) (*FileCrypt, error)
Constructor
params are optional parameters for the key header. If not supplied, the following default params are assigned: fcKTpye = FC_KEY_T_NOKEY / FC__KEY_T_DIRECT => No additional parameter required fcKType = FC_KEY_T_PBKDF2 => hashType : FC_HASH_SHA256, Niter : 60000 keyLen : 256 B, Salt Len : 12 Bytes
func NewFromFile ¶
Constructor from File
func (*FileCrypt) AddBlock ¶
Add block to Filecrypt object. It will encrypt it according the specified headers
func (FileCrypt) DecryptAll ¶
Filecrypt decryption routine. Takes some cyphertext file and based on the type of decryption
specified in the header applies the desired decryption algorithm.
func (FileCrypt) DecryptSingle ¶
Filecrypt decryption routine. Takes some cyphertext file and based on the type of decryption
specified in the header applies the desired decryption algorithm. Tag is used to decrypt block identified
by such tag
Click to show internal directories.
Click to hide internal directories.