bcrypt and null kdf done, work on ciphers next (then keytypes)
This commit is contained in:
1
cipher/aes/aes128/cbc/TODO
Normal file
1
cipher/aes/aes128/cbc/TODO
Normal file
@@ -0,0 +1 @@
|
||||
TODO
|
||||
5
cipher/aes/aes128/cbc/consts.go
Normal file
5
cipher/aes/aes128/cbc/consts.go
Normal file
@@ -0,0 +1,5 @@
|
||||
package cbc
|
||||
|
||||
const (
|
||||
Name string = "aes128-cbc"
|
||||
)
|
||||
10
cipher/aes/aes128/consts.go
Normal file
10
cipher/aes/aes128/consts.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package aes128
|
||||
|
||||
import (
|
||||
`r00t2.io/sshkeys/cipher/aes`
|
||||
)
|
||||
|
||||
const (
|
||||
KeySize int = 16 // in bytes; AES128 is so named for its 128-bit key, thus: 128 / 8 = 16
|
||||
KdfKeySize int = KeySize + aes.IvSize
|
||||
)
|
||||
1
cipher/aes/aes128/ctr/TODO
Normal file
1
cipher/aes/aes128/ctr/TODO
Normal file
@@ -0,0 +1 @@
|
||||
TODO
|
||||
5
cipher/aes/aes128/ctr/consts.go
Normal file
5
cipher/aes/aes128/ctr/consts.go
Normal file
@@ -0,0 +1,5 @@
|
||||
package ctr
|
||||
|
||||
const (
|
||||
Name string = "aes128-ctr"
|
||||
)
|
||||
1
cipher/aes/aes128/gcm/TODO
Normal file
1
cipher/aes/aes128/gcm/TODO
Normal file
@@ -0,0 +1 @@
|
||||
TODO
|
||||
5
cipher/aes/aes128/gcm/consts.go
Normal file
5
cipher/aes/aes128/gcm/consts.go
Normal file
@@ -0,0 +1,5 @@
|
||||
package gcm
|
||||
|
||||
const (
|
||||
Name string = "aes128-gcm@openssh.com"
|
||||
)
|
||||
1
cipher/aes/aes192/cbc/TODO
Normal file
1
cipher/aes/aes192/cbc/TODO
Normal file
@@ -0,0 +1 @@
|
||||
TODO
|
||||
5
cipher/aes/aes192/cbc/consts.go
Normal file
5
cipher/aes/aes192/cbc/consts.go
Normal file
@@ -0,0 +1,5 @@
|
||||
package cbc
|
||||
|
||||
const (
|
||||
Name string = "aes192-cbc"
|
||||
)
|
||||
10
cipher/aes/aes192/consts.go
Normal file
10
cipher/aes/aes192/consts.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package aes192
|
||||
|
||||
import (
|
||||
`r00t2.io/sshkeys/cipher/aes`
|
||||
)
|
||||
|
||||
const (
|
||||
KeySize int = 24 // in bytes; AES182 is so named for its 192-bit key, thus: 192 / 8 = 24
|
||||
KdfKeySize int = KeySize + aes.IvSize
|
||||
)
|
||||
1
cipher/aes/aes192/ctr/TODO
Normal file
1
cipher/aes/aes192/ctr/TODO
Normal file
@@ -0,0 +1 @@
|
||||
TODO
|
||||
5
cipher/aes/aes192/ctr/consts.go
Normal file
5
cipher/aes/aes192/ctr/consts.go
Normal file
@@ -0,0 +1,5 @@
|
||||
package ctr
|
||||
|
||||
const (
|
||||
Name string = "aes192-ctr"
|
||||
)
|
||||
1
cipher/aes/aes192/gcm/TODO
Normal file
1
cipher/aes/aes192/gcm/TODO
Normal file
@@ -0,0 +1 @@
|
||||
TODO
|
||||
5
cipher/aes/aes192/gcm/consts.go
Normal file
5
cipher/aes/aes192/gcm/consts.go
Normal file
@@ -0,0 +1,5 @@
|
||||
package gcm
|
||||
|
||||
const (
|
||||
Name string = "aes192-gcm@openssh.com"
|
||||
)
|
||||
1
cipher/aes/aes256/cbc/TODO
Normal file
1
cipher/aes/aes256/cbc/TODO
Normal file
@@ -0,0 +1 @@
|
||||
TODO
|
||||
5
cipher/aes/aes256/cbc/consts.go
Normal file
5
cipher/aes/aes256/cbc/consts.go
Normal file
@@ -0,0 +1,5 @@
|
||||
package cbc
|
||||
|
||||
const (
|
||||
Name string = "aes256-cbc"
|
||||
)
|
||||
10
cipher/aes/aes256/consts.go
Normal file
10
cipher/aes/aes256/consts.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package aes256
|
||||
|
||||
import (
|
||||
`r00t2.io/sshkeys/cipher/aes`
|
||||
)
|
||||
|
||||
const (
|
||||
KeySize int = 32 // in bytes; AES256 is so named for its 256-bit key, thus: 256 / 8 = 32
|
||||
KdfKeySize int = KeySize + aes.IvSize
|
||||
)
|
||||
1
cipher/aes/aes256/ctr/TODO
Normal file
1
cipher/aes/aes256/ctr/TODO
Normal file
@@ -0,0 +1 @@
|
||||
TODO
|
||||
5
cipher/aes/aes256/ctr/consts.go
Normal file
5
cipher/aes/aes256/ctr/consts.go
Normal file
@@ -0,0 +1,5 @@
|
||||
package ctr
|
||||
|
||||
const (
|
||||
Name string = "aes256-ctr"
|
||||
)
|
||||
1
cipher/aes/aes256/gcm/TODO
Normal file
1
cipher/aes/aes256/gcm/TODO
Normal file
@@ -0,0 +1 @@
|
||||
TODO
|
||||
5
cipher/aes/aes256/gcm/consts.go
Normal file
5
cipher/aes/aes256/gcm/consts.go
Normal file
@@ -0,0 +1,5 @@
|
||||
package gcm
|
||||
|
||||
const (
|
||||
Name string = "aes256-gcm@openssh.com"
|
||||
)
|
||||
10
cipher/aes/consts.go
Normal file
10
cipher/aes/consts.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package aes
|
||||
|
||||
import (
|
||||
`crypto/aes`
|
||||
)
|
||||
|
||||
const (
|
||||
BlockSize int = aes.BlockSize
|
||||
IvSize int = aes.BlockSize
|
||||
)
|
||||
1
cipher/chacha20/poly1305/TODO
Normal file
1
cipher/chacha20/poly1305/TODO
Normal file
@@ -0,0 +1 @@
|
||||
TODO
|
||||
1
cipher/null/TODO
Normal file
1
cipher/null/TODO
Normal file
@@ -0,0 +1 @@
|
||||
TODO
|
||||
1
cipher/tripledes/cbc/TODO
Normal file
1
cipher/tripledes/cbc/TODO
Normal file
@@ -0,0 +1 @@
|
||||
TODO
|
||||
50
cipher/types.go
Normal file
50
cipher/types.go
Normal file
@@ -0,0 +1,50 @@
|
||||
package cipher
|
||||
|
||||
import (
|
||||
`bytes`
|
||||
)
|
||||
|
||||
type Cipher interface {
|
||||
// Name returns the string form of the cipher name.
|
||||
Name() (name string)
|
||||
// NameBytes returns the Name result but in bytes, with a leading uint32 bytecount packed in.
|
||||
NameBytes() (name []byte)
|
||||
// BlockSize returns the blocksize of the cipher.Cipher. This is used for externally padding data for Cipher.Encrypt and Cipher.AllocateEncrypt.
|
||||
BlockSize() (size int)
|
||||
// KdfKeySize returns the desired/needed key size for use with kdf.KDF.
|
||||
KdfKeySize() (size int)
|
||||
// Setup initializes the Cipher with a given key.
|
||||
Setup(key []byte) (err error)
|
||||
/*
|
||||
Encrypt takes plain data, either a:
|
||||
- string
|
||||
- raw byte slice ([]byte or []uint8)
|
||||
- single byte (byte or uint8)
|
||||
- *bytes.Buffer
|
||||
and returns an encrypted *bytes.Buffer of data.
|
||||
*/
|
||||
Encrypt(data interface{}) (encrypted *bytes.Reader, err error)
|
||||
// AllocateEncrypt is exactly like cipher.Cipher.Encrypt except that it includes a (NON-encrypted) uint32 prefix of byte allocation.
|
||||
AllocateEncrypt(data interface{}) (encrypted *bytes.Reader, err error)
|
||||
/*
|
||||
Decrypt takes encrypted data, either a:
|
||||
- raw byte slice ([]byte or []uint8)
|
||||
- *bytes.Buffer
|
||||
and returns a plain/decrypted *bytes.Buffer of data.
|
||||
*/
|
||||
Decrypt(data interface{}) (decrypted *bytes.Reader, err error)
|
||||
// AllocatedDecrypt is exactly like cipher.Cipher.Decrypt except that it assumes that data includes a (NON-encrypted) uint32 prefix of byte allocation.
|
||||
AllocatedDecrypt(data interface{}) (decrypted *bytes.Reader, err error)
|
||||
// IsPlain returns true if this is a "null" cipher; i.e. no encryption is actually performed.
|
||||
IsPlain() (plain bool)
|
||||
/*
|
||||
Pad returns padded bytes in a *bytes.Buffer according to the cipher's padding specification.
|
||||
data can be one of either:
|
||||
- string
|
||||
- raw byte slice ([]byte or []uint8)
|
||||
- single byte (byte or uint8)
|
||||
- *bytes.Buffer
|
||||
This is a prerequisite in some ciphers, and must be performed BEFORE encrypting.
|
||||
*/
|
||||
Pad(data interface{}) (paddedBuf *bytes.Reader, err error)
|
||||
}
|
||||
Reference in New Issue
Block a user