rsa

package
v1.0.5008 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDataToLarge     = errors.New("message too long for RSA public key size")
	ErrDataLen         = errors.New("data length error")
	ErrDataBroken      = errors.New("data broken, first byte is not zero")
	ErrKeyPairDismatch = errors.New("data is not encrypted by the private key")
	ErrDecryption      = errors.New("decryption error")
)

Functions

func LowerSafeDecrypt

func LowerSafeDecrypt(priv *rsa.PrivateKey, msg []byte) ([]byte, error)

rsa no padding decrypt

func LowerSafeEncrypt

func LowerSafeEncrypt(pub *rsa.PublicKey, msg []byte) ([]byte, error)

rsa no padding encrypt

func MarshalXMLPrivateKey

func MarshalXMLPrivateKey(key *rsa.PrivateKey) ([]byte, error)

Marshal XML PrivateKey

func MarshalXMLPublicKey

func MarshalXMLPublicKey(key *rsa.PublicKey) ([]byte, error)

Marshal XML PublicKey

func ParseXMLPrivateKey

func ParseXMLPrivateKey(der []byte) (*rsa.PrivateKey, error)

Parse XML PrivateKey

func ParseXMLPublicKey

func ParseXMLPublicKey(der []byte) (*rsa.PublicKey, error)

Parse XML PublicKey

func PrivateKeyBytes

func PrivateKeyBytes(pri *rsa.PrivateKey, in []byte, isEncrytp bool) ([]byte, error)

PrivateKey Encrypt or Decrypt Bytes

func PublicKeyBytes

func PublicKeyBytes(pub *rsa.PublicKey, in []byte, isEncrytp bool) ([]byte, error)

PublicKey Encrypt or Decrypt Bytes

Types

type XMLKey

type XMLKey struct{}

*

  • rsa xml *
  • @create 2023-4-10
  • @author deatil

func NewXMLKey

func NewXMLKey() XMLKey

NewXMLKey

func (XMLKey) MarshalPrivateKey

func (this XMLKey) MarshalPrivateKey(key *rsa.PrivateKey) ([]byte, error)

Marshal XML PrivateKey

func (XMLKey) MarshalPublicKey

func (this XMLKey) MarshalPublicKey(key *rsa.PublicKey) ([]byte, error)

Marshal XML PublicKey

func (XMLKey) ParsePrivateKey

func (this XMLKey) ParsePrivateKey(der []byte) (*rsa.PrivateKey, error)

Parse XML PrivateKey

func (XMLKey) ParsePublicKey

func (this XMLKey) ParsePublicKey(der []byte) (*rsa.PublicKey, error)

Parse XML PublicKey

Jump to

Keyboard shortcuts

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