rsa

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(prvKey *rsa.PrivateKey, ciphertext []byte) ([]byte, error)

func Encrypt

func Encrypt(pubKey *rsa.PublicKey, plaintext []byte) ([]byte, error)

func Sign

func Sign(prvKey *rsa.PrivateKey, message []byte) ([]byte, error)

func Verify

func Verify(pubKey *rsa.PublicKey, message, sig []byte) bool

Types

type Envelope

type Envelope struct {
	Type          string `json:"type"`
	ShareKey      string `json:"key"`
	RecverAuthKey string `json:"dest"`
}

func Unmarshal

func Unmarshal(envelopeMap map[string]interface{}) Envelope

func (Envelope) GetDest

func (a Envelope) GetDest() string

type PrivateKey

type PrivateKey struct {
	// contains filtered or unexported fields
}

func NewPrivateKey

func NewPrivateKey(prvKey rsa.PrivateKey) *PrivateKey

func (PrivateKey) ExtractShareKey

func (p PrivateKey) ExtractShareKey(envelope caesar.Envelope) ([]byte, error)

func (PrivateKey) GetAuthKey

func (p PrivateKey) GetAuthKey() (string, error)

func (PrivateKey) Sign

func (p PrivateKey) Sign(message []byte) ([]byte, error)

type PublicKey

type PublicKey struct {
	// contains filtered or unexported fields
}

func NewPublicKey

func NewPublicKey(pubKey rsa.PublicKey, sshPubKey ssh.PublicKey) *PublicKey

func (PublicKey) GetAuthKey

func (p PublicKey) GetAuthKey() string

func (PublicKey) NewEnvelope

func (p PublicKey) NewEnvelope(shareKey []byte) (caesar.Envelope, error)

func (PublicKey) Verify

func (p PublicKey) Verify(message, sig []byte) bool

Jump to

Keyboard shortcuts

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