rsa

package
v0.0.0-...-3a038d9 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2016 License: Apache-2.0 Imports: 11 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cipher

type Cipher interface {
	Encrypt(plainText []byte) ([]byte, error)
	Decrypt(cipherText []byte) ([]byte, error)
	Sign(src []byte, hash crypto.Hash) ([]byte, error)
	Verify(src []byte, sign []byte, hash crypto.Hash) error
}

func NewCipher

func NewCipher(key Key, padding Padding, cipherMode CipherMode, signMode SignMode) Cipher

type CipherMode

type CipherMode interface {
	Encrypt(plainText []byte, puk *rsa.PublicKey) ([]byte, error)
	Decrypt(cipherText []byte, prk *rsa.PrivateKey) ([]byte, error)
}

func NewPKCS1v15Cipher

func NewPKCS1v15Cipher() CipherMode

type Key

type Key interface {
	PublicKey() *rsa.PublicKey
	PrivateKey() *rsa.PrivateKey
	Modulus() int
}

func LoadKeyFromPEMFile

func LoadKeyFromPEMFile(publicKeyFilePath, privateKeyFilePath string, ParseKey func([]byte, []byte) (Key, error)) (Key, error)

func ParsePKCS1Key

func ParsePKCS1Key(publicKey, privateKey []byte) (Key, error)

func ParsePKCS8Key

func ParsePKCS8Key(publicKey, privateKey []byte) (Key, error)

type Padding

type Padding interface {
	Padding(src []byte) [][]byte
}

func NewNoPadding

func NewNoPadding(modulus int) Padding

func NewOAEPPadding

func NewOAEPPadding(modulus int) Padding

func NewPKCS1Padding

func NewPKCS1Padding(modulus int) Padding

type SignMode

type SignMode interface {
	Sign(src []byte, hash crypto.Hash, prk *rsa.PrivateKey) ([]byte, error)
	Verify(src []byte, sign []byte, hash crypto.Hash, puk *rsa.PublicKey) error
}

func NewPKCS1v15Sign

func NewPKCS1v15Sign() SignMode

Jump to

Keyboard shortcuts

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