You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
818 B

  1. package crypto
  2. import (
  3. cmn "github.com/tendermint/tendermint/libs/common"
  4. )
  5. type PrivKey interface {
  6. Bytes() []byte
  7. Sign(msg []byte) (Signature, error)
  8. PubKey() PubKey
  9. Equals(PrivKey) bool
  10. }
  11. // An address is a []byte, but hex-encoded even in JSON.
  12. // []byte leaves us the option to change the address length.
  13. // Use an alias so Unmarshal methods (with ptr receivers) are available too.
  14. type Address = cmn.HexBytes
  15. type PubKey interface {
  16. Address() Address
  17. Bytes() []byte
  18. VerifyBytes(msg []byte, sig Signature) bool
  19. Equals(PubKey) bool
  20. }
  21. type Signature interface {
  22. Bytes() []byte
  23. IsZero() bool
  24. Equals(Signature) bool
  25. }
  26. type Symmetric interface {
  27. Keygen() []byte
  28. Encrypt(plaintext []byte, secret []byte) (ciphertext []byte)
  29. Decrypt(ciphertext []byte, secret []byte) (plaintext []byte, err error)
  30. }