Documentation ¶
Index ¶
- Constants
- Variables
- func DecryptFrom(from EncryptionPublicKey, to EncryptionPrivateKey, data []byte) ([]byte, error)
- func DecryptMessageFrom(ctx context.Context, to *Key, from EncryptionPublicKey, message *bank.Message) error
- func EncodeAuthenticationDigest(key AuthenticationDigest) string
- func EncodeAuthenticationKey(key AuthenticationKey) string
- func EncodePublicKey(key EncryptionPublicKey) string
- func EncodeSeedKey(key SeedKey) string
- func EncodeSignatureKey(key SignaturePublicKey) string
- func EncryptFor(from EncryptionPrivateKey, to EncryptionPublicKey, message []byte) ([]byte, error)
- func EncryptMessageFor(ctx context.Context, from *Key, to EncryptionPublicKey, message *bank.Message) error
- func GenerateNonce() ([NonceSize]byte, error)
- func GenerateSeed() ([SeedKeySize]byte, error)
- func NewHasherWorker(ctx context.Context, time, memory, thread int) bank.Worker
- func PasswordHashSeedContext(ctx context.Context, passwordHashSeed string) context.Context
- func SaltedHash(ctx context.Context, password []byte) []byte
- func SaltedHashVerify(ctx context.Context, password []byte, hash []byte) bool
- func Sign(secretKey SignatureSecretKey, data []byte) ([]byte, error)
- func SignMessage(ctx context.Context, key *Key, message *bank.Message) error
- func VerifyMessageAuthentication(authenticateKey AuthenticationKey, digest AuthenticationDigest, message []byte) bool
- func VerifyMessageSignature(key SignaturePublicKey, message *bank.Message) (bool, error)
- func VerifySignature(publicKey SignaturePublicKey, signedMessage []byte) (bool, error)
- type AuthenticationDigest
- type AuthenticationKey
- type EncryptionPrivateKey
- type EncryptionPublicKey
- type HashSeed
- type HashSeedKey
- type HasherWorker
- type Key
- func (p *Key) AuthenticationKey(ctx context.Context) AuthenticationKey
- func (p *Key) DecryptFrom(ctx context.Context, from EncryptionPublicKey, data []byte) ([]byte, error)
- func (p *Key) EncryptFor(ctx context.Context, to EncryptionPublicKey, data []byte) ([]byte, error)
- func (p *Key) Public(ctx context.Context) EncryptionPublicKey
- func (p *Key) SignMessage(ctx context.Context, message []byte) ([]byte, error)
- func (p *Key) SignPublicKey(ctx context.Context) SignaturePublicKey
- func (p *Key) Wipe()
- type SecretKey
- type SeedKey
- type SignaturePublicKey
- type SignatureSecretKey
Constants ¶
View Source
const ( SignatureSecretKeySize = ed25519.PrivateKeySize SignaturePublicKeySize = ed25519.PublicKeySize EncryptionKeySize = sodium.Curve25519Size NonceSize = 24 MinSaltSize = 24 AuthenticationKeySize = EncryptionKeySize AuthenticationKeyDigestSize = EncryptionKeySize SeedKeySize = ed25519.SeedSize HashSeedKeySize = 32 )
View Source
const (
KeyHasherWorker = "Security.KeyHasherWorker"
)
View Source
const (
KeyPasswordHashSeed = "Security.KeyPasswordHashSeed"
)
View Source
const (
KeyPrivateKeySalt = "Key.PrivateKeySalt"
)
Variables ¶
View Source
var ( ErrEncrypt = errors.New("Failed to Encrypt") ErrOperationNotPermited = errors.New("Operation Not Permited") ErrSignature = errors.New("Failed to Sign message") ErrNotSigned = errors.New("Message Not Signed") ErrVerifyFailed = errors.New("Fail to verify signature") )
View Source
var ( ErrInvalidKey = errors.New("Invalid key") ErrSignMessage = errors.New("Message Sign Failed") ErrVerifySignature = errors.New("Signature verification failed") ErrNoSignature = errors.New("No Signature found") )
View Source
var (
DefaultAlphabet = base58.BitcoinAlphabet
)
Functions ¶
func DecryptFrom ¶
func DecryptFrom(from EncryptionPublicKey, to EncryptionPrivateKey, data []byte) ([]byte, error)
func DecryptMessageFrom ¶
func DecryptMessageFrom(ctx context.Context, to *Key, from EncryptionPublicKey, message *bank.Message) error
func EncodeAuthenticationDigest ¶
func EncodeAuthenticationDigest(key AuthenticationDigest) string
func EncodeAuthenticationKey ¶
func EncodeAuthenticationKey(key AuthenticationKey) string
func EncodePublicKey ¶
func EncodePublicKey(key EncryptionPublicKey) string
func EncodeSeedKey ¶
func EncodeSignatureKey ¶
func EncodeSignatureKey(key SignaturePublicKey) string
func EncryptFor ¶
func EncryptFor(from EncryptionPrivateKey, to EncryptionPublicKey, message []byte) ([]byte, error)
func EncryptMessageFor ¶
func EncryptMessageFor(ctx context.Context, from *Key, to EncryptionPublicKey, message *bank.Message) error
func GenerateNonce ¶
func GenerateSeed ¶
func GenerateSeed() ([SeedKeySize]byte, error)
func NewHasherWorker ¶
func PasswordHashSeedContext ¶
func SaltedHash ¶
SaltedHash return argon2 key from salt and input do not store or reuse salt
func SaltedHashVerify ¶
SaltedHashVerify check if hash correspond to argon2 hash from salt and input do not store or reuse salt
func VerifyMessageAuthentication ¶
func VerifyMessageAuthentication(authenticateKey AuthenticationKey, digest AuthenticationDigest, message []byte) bool
func VerifyMessageSignature ¶
func VerifyMessageSignature(key SignaturePublicKey, message *bank.Message) (bool, error)
func VerifySignature ¶
func VerifySignature(publicKey SignaturePublicKey, signedMessage []byte) (bool, error)
Types ¶
type AuthenticationDigest ¶
type AuthenticationDigest [AuthenticationKeyDigestSize]byte
func AuthenticateMessage ¶
func AuthenticateMessage(authenticateKey AuthenticationKey, message []byte) AuthenticationDigest
func DecodeAuthenticationDigest ¶
func DecodeAuthenticationDigest(encoded string) (AuthenticationDigest, error)
type AuthenticationKey ¶
type AuthenticationKey [AuthenticationKeySize]byte
func DecodeAuthenticationKey ¶
func DecodeAuthenticationKey(encoded string) (AuthenticationKey, error)
type EncryptionPrivateKey ¶
type EncryptionPrivateKey [EncryptionKeySize]byte
type EncryptionPublicKey ¶
type EncryptionPublicKey [EncryptionKeySize]byte
func DecodePublicKey ¶
func DecodePublicKey(encoded string) (EncryptionPublicKey, error)
type HashSeedKey ¶
type HashSeedKey [HashSeedKeySize]byte
func PasswordHashSalt ¶
func PasswordHashSalt(ctx context.Context) HashSeedKey
type HasherWorker ¶
type HasherWorker struct {
// contains filtered or unexported fields
}
type Key ¶
func (*Key) AuthenticationKey ¶
func (p *Key) AuthenticationKey(ctx context.Context) AuthenticationKey
func (*Key) DecryptFrom ¶
func (*Key) EncryptFor ¶
func (*Key) SignMessage ¶
func (*Key) SignPublicKey ¶
func (p *Key) SignPublicKey(ctx context.Context) SignaturePublicKey
type SecretKey ¶
type SecretKey [SignatureSecretKeySize]byte
type SignaturePublicKey ¶
type SignaturePublicKey [SignaturePublicKeySize]byte
func DecodeSignatureKey ¶
func DecodeSignatureKey(encoded string) (SignaturePublicKey, error)
type SignatureSecretKey ¶
type SignatureSecretKey [SignatureSecretKeySize]byte
Source Files ¶
Click to show internal directories.
Click to hide internal directories.