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.

30 lines
727 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) ([]byte, 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 []byte) bool
  19. Equals(PubKey) bool
  20. }
  21. type Symmetric interface {
  22. Keygen() []byte
  23. Encrypt(plaintext []byte, secret []byte) (ciphertext []byte)
  24. Decrypt(ciphertext []byte, secret []byte) (plaintext []byte, err error)
  25. }