Documentation ¶
Index ¶
- Constants
- Variables
- func AppendToSignedHash(s SignedHash, i Identity) error
- func DecodeKeys(id string) (cryptKey []byte, signKey []byte, err error)
- func DecryptAES(encrypted []byte, key []byte) ([]byte, error)
- func DecryptBlock(key []byte, nonce []byte, cipherdata []byte) ([]byte, error)
- func DelIdentity(id string) error
- func DiffieHellmanKey(identity Identity, id string) ([]byte, error)
- func EcDecrypt(identity Identity, data []byte) ([]byte, error)
- func EcEncrypt(id string, data []byte) ([]byte, error)
- func EncryptAES(data []byte, key []byte) ([]byte, error)
- func EncryptBlock(key []byte, nonce []byte, data []byte) ([]byte, error)
- func EncryptingReader(keyId uint64, keyFunc func(uint64) []byte, r io.ReadSeekCloser) (io.ReadSeekCloser, error)
- func FileHash(name string) ([]byte, error)
- func GenerateBytesKey(size int) []byte
- func Marshal(identity Identity, v any, signatureField string) ([]byte, error)
- func NewHash() hash.Hash
- func QuickHash(data []byte) []byte
- func SetIdentity(i Identity) error
- func Sign(identity Identity, data []byte) ([]byte, error)
- func Unmarshal(data []byte, v any, signatureField string) (id string, err error)
- func Verify(id string, data []byte, sig []byte) bool
- func VerifySignedHash(s SignedHash, trusts []Identity, hash []byte) bool
- type HashReader
- type HashWriter
- type Identity
- type Key
- type PrivateKey
- type Public
- type PublicKey
- type SignedData
- type SignedHash
- type SignedHashEvidence
- type StreamReader
- type StreamWriter
Constants ¶
View Source
const ( Secp256k1 = "secp256k1" Ed25519 = "ed25519" )
View Source
const ( PublicKeySize = ed25519.PublicKeySize PrivateKeySize = ed25519.PrivateKeySize SignatureSize = ed25519.SignatureSize )
View Source
const AESHeaderSize = 8 + aes.BlockSize
View Source
const SignatureField = "dgst_ed25519_blake2b"
Variables ¶
View Source
var ErrInvalidID = errors.New("ID is neither a public or private key")
View Source
var ErrInvalidSignature = errors.New("signature is invalid")
Functions ¶
func AppendToSignedHash ¶
func AppendToSignedHash(s SignedHash, i Identity) error
func DecryptAES ¶
DecryptAES decrypts an encrypted byte array using AES decryption with the provided key.
func DelIdentity ¶
func EncryptAES ¶
EncryptAES encrypts a byte array using AES encryption with the provided key.
func EncryptingReader ¶
func EncryptingReader(keyId uint64, keyFunc func(uint64) []byte, r io.ReadSeekCloser) (io.ReadSeekCloser, error)
EncryptedWriter wraps w with an OFB cipher stream.
func GenerateBytesKey ¶
func SetIdentity ¶
func VerifySignedHash ¶
func VerifySignedHash(s SignedHash, trusts []Identity, hash []byte) bool
Types ¶
type HashReader ¶
func NewHashReader ¶
func NewHashReader(r io.ReadSeekCloser) (*HashReader, error)
func (*HashReader) Close ¶
func (s *HashReader) Close() error
type HashWriter ¶
func NewHashWriter ¶
func NewHashWriter(w io.Writer) (*HashWriter, error)
type Identity ¶
type Identity struct { Id string `json:"i"` // public key Nick string `json:"n,omitempty"` // nickname Email string `json:"e,omitempty"` // email ModTime time.Time `json:"m"` // last modification time Private string `json:"p,omitempty"` // private key Avatar []byte `json:"a,omitempty"` // avatar }
func GetIdentities ¶
func GetIdentity ¶
func NewIdentity ¶
func NewIdentityFromId ¶
type PrivateKey ¶
type PrivateKey ed25519.PrivateKey
type SignedData ¶
type SignedData struct { Signature [SignatureSize]byte Signer PublicKey }
type SignedHash ¶
func NewSignedHash ¶
func NewSignedHash(hash []byte, i Identity) (SignedHash, error)
type SignedHashEvidence ¶
type StreamReader ¶
type StreamReader struct {
// contains filtered or unexported fields
}
func (*StreamReader) Close ¶
func (sr *StreamReader) Close() error
type StreamWriter ¶
type StreamWriter struct {
// contains filtered or unexported fields
}
func DecryptingWriter ¶
EncryptedWriter wraps w with an OFB cipher stream.
Click to show internal directories.
Click to hide internal directories.