Skip to content

How to implement importing public keys into RSA·· #215

@birdycn

Description

@birdycn

My go rsa encrypt /decrypt like:

how to implement with using cryptography?

func Encrypt(pub *rsa.PublicKey, data []byte) ([]byte, error) {
	hash := sha256.New()

	return rsa.EncryptOAEP(hash, rand.Reader, pub, data, nil)
}

func Decrypt(priv *rsa.PrivateKey, ciphertext []byte) ([]byte, error) {
	hash := sha256.New()

	return rsa.DecryptOAEP(hash, rand.Reader, priv, ciphertext, nil)
}

``

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions