Рыба проекта. Минимальная функциональность
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
package crypto
|
||||
|
||||
import "io"
|
||||
|
||||
// KEM defines the contract for a Key Encapsulation Mechanism.
|
||||
type KEM interface {
|
||||
SchemeID() uint16
|
||||
GenerateKeyPair(
|
||||
rand io.Reader,
|
||||
) (
|
||||
RecipientPub,
|
||||
RecipientPriv,
|
||||
error,
|
||||
)
|
||||
Encapsulate(
|
||||
pub RecipientPub,
|
||||
rand io.Reader,
|
||||
) (
|
||||
ciphertext []byte,
|
||||
sharedSecret []byte,
|
||||
err error,
|
||||
)
|
||||
Decapsulate(
|
||||
priv RecipientPriv,
|
||||
ciphertext []byte,
|
||||
) (
|
||||
sharedSecret []byte,
|
||||
err error,
|
||||
)
|
||||
LoadPriv(
|
||||
raw []byte,
|
||||
) (
|
||||
RecipientPriv,
|
||||
error,
|
||||
)
|
||||
}
|
||||
|
||||
// RecipientPub represents a public recipient key.
|
||||
type RecipientPub interface {
|
||||
SchemeID() uint16
|
||||
KeyID() []byte
|
||||
Raw() []byte
|
||||
}
|
||||
|
||||
// RecipientPriv represents a private recipient key.
|
||||
type RecipientPriv interface {
|
||||
SchemeID() uint16
|
||||
KeyID() []byte
|
||||
Raw() []byte
|
||||
}
|
||||
Reference in New Issue
Block a user