Documentation ¶
Index ¶
- Variables
- func GeneratePubKey(privID *identity.Private, expiry time.Duration) (*wire.MsgPubKey, error)
- func SignAndEncryptBroadcast(msg *wire.MsgBroadcast, privID *identity.Private) error
- func SignAndEncryptMsg(msg *wire.MsgMsg, privID *identity.Private, pubID *identity.Public) error
- func SignAndEncryptPubKey(msg *wire.MsgPubKey, privID *identity.Private) error
- func TryDecryptAndVerifyBroadcast(msg *wire.MsgBroadcast, address *bmutil.Address) error
- func TryDecryptAndVerifyMsg(msg *wire.MsgMsg, privID *identity.Private) error
- func TryDecryptAndVerifyPubKey(msg *wire.MsgPubKey, address *bmutil.Address) error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUnsupportedOp is returned when the attempted operation is unsupported. ErrUnsupportedOp = errors.New("operation unsupported") // ErrInvalidSignature is returned when the signature embedded in the // message is malformed or fails to verify (because of invalid checksum). ErrInvalidSignature = errors.New("invalid signature/verification failed") // ErrInvalidIdentity is returned when the provided address/identity is // unable to decrypt the given message. ErrInvalidIdentity = errors.New("invalid supplied identity/decryption failed") )
Functions ¶
func GeneratePubKey ¶
GeneratePubKey generates a wire.MsgPubKey from the specified private identity. It also signs and encrypts it (if necessary) yielding an object that only needs proof-of-work to be done on it.
func SignAndEncryptBroadcast ¶
func SignAndEncryptBroadcast(msg *wire.MsgBroadcast, privID *identity.Private) error
SignAndEncryptBroadcast signs and encrypts a MsgBroadcast message, populating the Signature and Encrypted fields using the provided private identity.
The private identity supplied should be of the sender. There are no checks against supplying invalid private identity.
func SignAndEncryptMsg ¶
SignAndEncryptMsg signs and encrypts a MsgMsg message, populating the Signature and Encrypted fields using the provided private identity.
The private identity supplied should be of the sender. The public identity should be that of the recipient. There are no checks against supplying invalid private or public identities.
func SignAndEncryptPubKey ¶
SignAndEncryptPubKey signs and encrypts a MsgPubKey message, populating the Signature and Encrypted fields using the provided private identity.
The private identity supplied should be of the sender. There are no checks against supplying invalid private identity.
func TryDecryptAndVerifyBroadcast ¶
func TryDecryptAndVerifyBroadcast(msg *wire.MsgBroadcast, address *bmutil.Address) error
TryDecryptAndVerifyBroadcast tries to decrypt a wire.MsgBroadcast of the public identity. If it fails, it returns ErrInvalidIdentity. If decryption succeeds, it verifies the embedded signature. If signature verification fails, it returns ErrInvalidSignature. Else, it returns nil.
All necessary fields of the provided wire.MsgBroadcast are populated.
func TryDecryptAndVerifyMsg ¶
TryDecryptAndVerifyMsg tries to decrypt a wire.MsgMsg using the private identity. If it fails, it returns ErrInvalidIdentity. If decryption succeeds, it verifies the embedded signature. If signature verification fails, it returns ErrInvalidSignature. Else, it returns nil.
All necessary fields of the provided wire.MsgMsg are populated.
func TryDecryptAndVerifyPubKey ¶
TryDecryptAndVerifyPubKey tries to decrypt a wire.MsgPubKey of the address. If it fails, it returns ErrInvalidIdentity. If decryption succeeds, it verifies the embedded signature. If signature verification fails, it returns ErrInvalidSignature. Else, it returns nil.
All necessary fields of the provided wire.MsgPubKey are populated.
Types ¶
This section is empty.