Documentation ¶
Overview ¶
Package secrets provides RSA codec to work with Calyptia Cloud pipeline secrets.
Index ¶
- Constants
- func BytesToPrivateKey(privateKey []byte) (*rsa.PrivateKey, error)
- func BytesToPublicKey(publicKey []byte) (*rsa.PublicKey, error)
- func Decrypt(hash hash.Hash, privateKey *rsa.PrivateKey, msg []byte) ([]byte, error)
- func Encrypt(hash hash.Hash, publicKey *rsa.PublicKey, msg []byte) ([]byte, error)
- func PrivateKeyToBytes(priv *rsa.PrivateKey) []byte
- func PublicKeyToBytes(pub *rsa.PublicKey) ([]byte, error)
- type RSA
Constants ¶
const (
DefaultEncryptionBits = 2048
)
Variables ¶
This section is empty.
Functions ¶
func BytesToPrivateKey ¶
func BytesToPrivateKey(privateKey []byte) (*rsa.PrivateKey, error)
func Decrypt ¶ added in v1.2.0
Decrypt decrypts the given ciphertext using RSA-OAEP with the given private key.
The ciphertext is split into chunks of size k, where k is the size of the private key in bytes. Each chunk is decrypted separately and the resulting plaintexts are concatenated.
At the end it returns the plaintext decrypted.
func Encrypt ¶ added in v1.2.0
Encrypt encrypts the given message using RSA-OAEP with the given public key.
The message is split into chunks of size k - 2*hLen - 2, where k is the size of the public key in bytes and hLen is the length of the hash function used. Each chunk is encrypted separately and the resulting ciphertexts are concatenated.
At the end it returns the ciphertext encrypted.
func PrivateKeyToBytes ¶
func PrivateKeyToBytes(priv *rsa.PrivateKey) []byte
Types ¶
type RSA ¶
type RSA struct {
Bits int
}