Documentation ¶
Index ¶
- Constants
- Variables
- func DecryptFrom(from EncryptionPublicKey, to EncryptionPrivateKey, data []byte) ([]byte, 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 GenerateNonce() ([NonceSize]byte, error)
- func GenerateSeed() ([SeedKeySize]byte, error)
- 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 VerifyMessageAuthentication(authenticateKey AuthenticationKey, digest AuthenticationDigest, message []byte) bool
- 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 KeysMap
- type Options
- type SecretKey
- type SecureID
- type SecureIDKeys
- func (p *SecureIDKeys) FromSecureID(context string, secureID secureid.SecureID) (secureid.Value, error)
- func (p *SecureIDKeys) Parse(secureID string) secureid.SecureID
- func (p *SecureIDKeys) SubKey(context string) *secureid.Keys
- func (p *SecureIDKeys) ToSecureID(context string, value secureid.Value) (secureid.SecureID, error)
- func (p *SecureIDKeys) ToString(secureID secureid.SecureID) string
- 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 ( ErrInvalidKeys = errors.New("Invalid SecureID Keys") InvalidSecureIDString = errors.New("Invalid SecureID String") )
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") ErrNoData = errors.New("No Data") )
View Source
var (
DefaultAlphabet = base58.BitcoinAlphabet
)
Functions ¶
func DecryptFrom ¶
func DecryptFrom(from EncryptionPublicKey, to EncryptionPrivateKey, data []byte) ([]byte, 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 GenerateNonce ¶
func GenerateSeed ¶
func GenerateSeed() ([SeedKeySize]byte, error)
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 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
}
func NewHasherWorker ¶
func NewHasherWorker(ctx context.Context, time, memory, thread int) *HasherWorker
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 SecureID ¶ added in v0.1.0
type SecureID interface { ToSecureID(context string, value secureid.Value) (secureid.SecureID, error) FromSecureID(context string, secureID secureid.SecureID) (secureid.Value, error) ToString(secureID secureid.SecureID) string Parse(secureID string) secureid.SecureID }
func FromOptions ¶ added in v0.1.0
func SecureIDFromFile ¶ added in v0.1.0
type SecureIDKeys ¶ added in v0.1.0
func (*SecureIDKeys) FromSecureID ¶ added in v0.1.0
func (*SecureIDKeys) Parse ¶ added in v0.1.0
func (p *SecureIDKeys) Parse(secureID string) secureid.SecureID
func (*SecureIDKeys) SubKey ¶ added in v0.1.0
func (p *SecureIDKeys) SubKey(context string) *secureid.Keys
func (*SecureIDKeys) ToSecureID ¶ added in v0.1.0
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.