crypto

package
v0.5.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 11, 2022 License: Apache-2.0 Imports: 13 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(msg []byte, sk ed25519.PrivateKey) ([]byte, error)

Decrypt decrypts msg with a cure25519 private key derived from an ed25519 private key

func DecryptECDH added in v0.4.9

func DecryptECDH(msg []byte, sk ed25519.PrivateKey, pk ed25519.PublicKey) ([]byte, error)

DecryptECDH decrypt aes encrypted msg using a shared key derived from sk and pk using Elliptic curve Diffie Helman algorithm

func Encrypt

func Encrypt(msg []byte, pk ed25519.PublicKey) ([]byte, error)

Encrypt encrypts msg with a cure25519 public key derived from an ed25519 public key

func EncryptECDH added in v0.4.9

func EncryptECDH(msg []byte, sk ed25519.PrivateKey, pk ed25519.PublicKey) ([]byte, error)

EncryptECDH aes encrypt msg using a shared key derived from sk and pk using Elliptic curve Diffie Helman algorithm the nonce if prepended to the encrypted message

func KeyFromHex

func KeyFromHex(h string) (ed25519.PublicKey, error)

KeyFromHex extract the public key from a hex string (used with jsx keys)

func KeyFromID

func KeyFromID(id pkg.Identifier) (ed25519.PublicKey, error)

KeyFromID extract the public key from an Identifier

func PrivateKeyToCurve25519 added in v0.4.0

func PrivateKeyToCurve25519(sk ed25519.PrivateKey) [32]byte

PrivateKeyToCurve25519 converts an ed25519 private key into a corresponding curve25519 private key such that the resulting curve25519 public key will equal the result from PublicKeyToCurve25519.

func PublicKeyToCurve25519 added in v0.4.0

func PublicKeyToCurve25519(pk ed25519.PublicKey) [32]byte

PublicKeyToCurve25519 converts an Ed25519 public key into the curve25519 public

key that would be generated from the same private key.

func Sign

func Sign(privateKey ed25519.PrivateKey, message []byte) ([]byte, error)

Sign signs the message with privateKey and returns a signature.

func Verify

func Verify(publicKey ed25519.PublicKey, message, sig []byte) error

Verify reports whether sig is a valid signature of message by publicKey.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL