pubdecrypt

package module
v0.0.0-...-70e9018 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

README

pubdecrypt

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecryptPKCS1v15

func DecryptPKCS1v15(rand io.Reader, pub *rsa.PublicKey, ciphertext []byte) ([]byte, error)

DecryptPKCS1v15 decrypts a plaintext using RSA and the padding scheme from PKCS#1 v1.5. If rand != nil, it uses RSA blinding to avoid timing side-channel attacks.

Note that whether this function returns an error or not discloses secret information. If an attacker can cause this function to run repeatedly and learn whether each instance returned an error then they can decrypt and forge signatures as if they had the private key. See DecryptPKCS1v15SessionKey for a way of solving this problem.

Originally from https://golang.org/src/crypto/rsa/pkcs1v15.go?s=2396:2485#L66

func EncryptPKCS1v15

func EncryptPKCS1v15(rand io.Reader, priv *rsa.PrivateKey, msg []byte) ([]byte, error)

EncryptPKCS1v15 encrypts the given message with RSA and the padding scheme from PKCS#1 v1.5. The message must be no longer than the length of the public modulus minus 11 bytes.

The rand parameter is used as a source of entropy to ensure that encrypting the same message twice doesn't result in the same ciphertext.

WARNING: use of this function to encrypt plaintexts other than session keys is dangerous. Use RSA OAEP in new protocols.

Originally from https://github.com/golang/go/blob/release-branch.go1.14/src/crypto/rsa/pkcs1v15.go#L29-L66

func RsaEncrypt

func RsaEncrypt(m, e, n *big.Int) *big.Int

RsaEncrypt implements the RSA algorithm for encrypting/decrypting

Types

This section is empty.

Jump to

Keyboard shortcuts

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