Documentation ¶
Overview ¶
Package crypto is a generated GoMock package.
Package crypto is a generated GoMock package.
Index ¶
- func RandomCurve25519Keys() (e4crypto.Curve25519PublicKey, e4crypto.Curve25519PrivateKey, error)
- type C2KeyRotationTx
- type E4Key
- type MockC2KeyRotationTx
- type MockC2KeyRotationTxMockRecorder
- type MockE4Key
- func (m *MockE4Key) EXPECT() *MockE4KeyMockRecorder
- func (m *MockE4Key) IsPubKeyMode() bool
- func (m *MockE4Key) NewC2KeyRotationTx() (C2KeyRotationTx, error)
- func (m *MockE4Key) ProtectCommand(arg0 commands.Command, arg1 []byte) ([]byte, error)
- func (m *MockE4Key) RandomKey() ([]byte, []byte, error)
- func (m *MockE4Key) ValidateKey(arg0 []byte) error
- type MockE4KeyMockRecorder
- func (mr *MockE4KeyMockRecorder) IsPubKeyMode() *gomock.Call
- func (mr *MockE4KeyMockRecorder) NewC2KeyRotationTx() *gomock.Call
- func (mr *MockE4KeyMockRecorder) ProtectCommand(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockE4KeyMockRecorder) RandomKey() *gomock.Call
- func (mr *MockE4KeyMockRecorder) ValidateKey(arg0 interface{}) *gomock.Call
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RandomCurve25519Keys ¶
func RandomCurve25519Keys() (e4crypto.Curve25519PublicKey, e4crypto.Curve25519PrivateKey, error)
RandomCurve25519Keys creates a new random Curve25519 key pair
Types ¶
type C2KeyRotationTx ¶
type C2KeyRotationTx interface { // GetNewPublicKey returns the future Curve25519 public key of the C2 // which is not yet applied to the E4Key. GetNewPublicKey() e4crypto.Curve25519PublicKey // Commit will replaces the current E4Key public and private C2 keys by the new ones. Commit() error // Rollback allows to restore the current key into the key file with the Rollback() error }
C2KeyRotationTx defines a C2 key rotation transaction It allows to access the newly generated C2 public key before applying it to the E4Key. A backup of the current key is made on transaction creation, and removed if it get rollbacked. When committed, the e4Key will be updated with the new C2 key pair, and the current key file will be overwritten with the new private key bytes.
type E4Key ¶
type E4Key interface { // ProtectCommand encrypt the given command using the key material private key // and returns the protected command, or an error ProtectCommand(cmd commands.Command, clientKey []byte) ([]byte, error) // ValidateKey will return an error if given key does not match the expected key type by the E4Key implementation ValidateKey(key []byte) error // RandomKey generates a new random key, and returns distinct variables for the key to be sent to the client // and the one to be stored. // If the key has a public part, the clientKey will contains the private part and the c2StoredKey the public part // If the key is a symmetric one, both clientKey and c2StoredKey will be equals. RandomKey() (clientKey, c2StoredKey []byte, err error) // IsPubKeyMode returns true when the E4Key support pubkey mode, or false otherwise IsPubKeyMode() bool // NewC2KeyRotationTx creates a transaction to update the E4Key with a new C2 curve25519 key pair. // On creation, it will backup the current C2 key file, and generate a new key pair. // On commit, it will write the new key in the key file, and activate the new key, that will start being used immediately. // On rollback, it will restore the original key file from the backup file, and delete the backup. // On error creating the transaction, the current key is not modified. // It will fail if the given E4Key is not in pubKey mode. NewC2KeyRotationTx() (C2KeyRotationTx, error) }
E4Key defines an interface to protect client commands
func NewE4PubKey ¶
NewE4PubKey creates a new E4 Public key, reading the private curve25519 key from the given path.
func NewE4SymKey ¶
func NewE4SymKey() E4Key
NewE4SymKey creates a new E4Key able to protect message and commands using a symmetric key
type MockC2KeyRotationTx ¶
type MockC2KeyRotationTx struct {
// contains filtered or unexported fields
}
MockC2KeyRotationTx is a mock of C2KeyRotationTx interface
func NewMockC2KeyRotationTx ¶
func NewMockC2KeyRotationTx(ctrl *gomock.Controller) *MockC2KeyRotationTx
NewMockC2KeyRotationTx creates a new mock instance
func (*MockC2KeyRotationTx) Commit ¶
func (m *MockC2KeyRotationTx) Commit() error
Commit mocks base method
func (*MockC2KeyRotationTx) EXPECT ¶
func (m *MockC2KeyRotationTx) EXPECT() *MockC2KeyRotationTxMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockC2KeyRotationTx) GetNewPublicKey ¶
func (m *MockC2KeyRotationTx) GetNewPublicKey() []byte
GetNewPublicKey mocks base method
func (*MockC2KeyRotationTx) Rollback ¶
func (m *MockC2KeyRotationTx) Rollback() error
Rollback mocks base method
type MockC2KeyRotationTxMockRecorder ¶
type MockC2KeyRotationTxMockRecorder struct {
// contains filtered or unexported fields
}
MockC2KeyRotationTxMockRecorder is the mock recorder for MockC2KeyRotationTx
func (*MockC2KeyRotationTxMockRecorder) Commit ¶
func (mr *MockC2KeyRotationTxMockRecorder) Commit() *gomock.Call
Commit indicates an expected call of Commit
func (*MockC2KeyRotationTxMockRecorder) GetNewPublicKey ¶
func (mr *MockC2KeyRotationTxMockRecorder) GetNewPublicKey() *gomock.Call
GetNewPublicKey indicates an expected call of GetNewPublicKey
func (*MockC2KeyRotationTxMockRecorder) Rollback ¶
func (mr *MockC2KeyRotationTxMockRecorder) Rollback() *gomock.Call
Rollback indicates an expected call of Rollback
type MockE4Key ¶
type MockE4Key struct {
// contains filtered or unexported fields
}
MockE4Key is a mock of E4Key interface
func NewMockE4Key ¶
func NewMockE4Key(ctrl *gomock.Controller) *MockE4Key
NewMockE4Key creates a new mock instance
func (*MockE4Key) EXPECT ¶
func (m *MockE4Key) EXPECT() *MockE4KeyMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockE4Key) IsPubKeyMode ¶
IsPubKeyMode mocks base method
func (*MockE4Key) NewC2KeyRotationTx ¶
func (m *MockE4Key) NewC2KeyRotationTx() (C2KeyRotationTx, error)
NewC2KeyRotationTx mocks base method
func (*MockE4Key) ProtectCommand ¶
ProtectCommand mocks base method
func (*MockE4Key) ValidateKey ¶
ValidateKey mocks base method
type MockE4KeyMockRecorder ¶
type MockE4KeyMockRecorder struct {
// contains filtered or unexported fields
}
MockE4KeyMockRecorder is the mock recorder for MockE4Key
func (*MockE4KeyMockRecorder) IsPubKeyMode ¶
func (mr *MockE4KeyMockRecorder) IsPubKeyMode() *gomock.Call
IsPubKeyMode indicates an expected call of IsPubKeyMode
func (*MockE4KeyMockRecorder) NewC2KeyRotationTx ¶
func (mr *MockE4KeyMockRecorder) NewC2KeyRotationTx() *gomock.Call
NewC2KeyRotationTx indicates an expected call of NewC2KeyRotationTx
func (*MockE4KeyMockRecorder) ProtectCommand ¶
func (mr *MockE4KeyMockRecorder) ProtectCommand(arg0, arg1 interface{}) *gomock.Call
ProtectCommand indicates an expected call of ProtectCommand
func (*MockE4KeyMockRecorder) RandomKey ¶
func (mr *MockE4KeyMockRecorder) RandomKey() *gomock.Call
RandomKey indicates an expected call of RandomKey
func (*MockE4KeyMockRecorder) ValidateKey ¶
func (mr *MockE4KeyMockRecorder) ValidateKey(arg0 interface{}) *gomock.Call
ValidateKey indicates an expected call of ValidateKey