Documentation
¶
Index ¶
- func DecryptWithRSA(privateKey *rsa.PrivateKey, ciphertext []byte, label []byte) ([]byte, error)
- func EncodePrivateKeyToPEM(privateKey *rsa.PrivateKey) []byte
- func EncodePublicKeyToPEM(publicKey *rsa.PublicKey) []byte
- func EncryptWithRSA(publicKey *rsa.PublicKey, data []byte, label []byte) ([]byte, error)
- func GenerateRSAKeyPair(bits int) (*rsa.PrivateKey, *rsa.PublicKey, error)
- func PrivateKeyFromBase64(buf []byte) (*rsa.PrivateKey, error)
- func ReadPrivateKeyFromFile(privateKeyPath string) (*rsa.PrivateKey, error)
- func ReadPublicKeyFromFile(publicKeyPath string) (*rsa.PublicKey, error)
- func WriteKeyPairToFiles(privateKey *rsa.PrivateKey, privateKeyPath, publicKeyPath string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecryptWithRSA ¶
DecryptWithRSA decrypts data using RSA-OAEP with SHA256
func EncodePrivateKeyToPEM ¶
func EncodePrivateKeyToPEM(privateKey *rsa.PrivateKey) []byte
EncodePrivateKeyToPEM converts an RSA private key to PEM format using PKCS#8
func EncodePublicKeyToPEM ¶
EncodePublicKeyToPEM converts an RSA public key to PEM format using PKIX
func EncryptWithRSA ¶
EncryptWithRSA encrypts data using RSA-OAEP with SHA256
func GenerateRSAKeyPair ¶
GenerateRSAKeyPair generates a new RSA key pair with the specified bit size
func PrivateKeyFromBase64 ¶
func PrivateKeyFromBase64(buf []byte) (*rsa.PrivateKey, error)
PrivateKeyFromBase64 decodes a base64 encoded PEM string and parses it into an RSA private key
func ReadPrivateKeyFromFile ¶
func ReadPrivateKeyFromFile(privateKeyPath string) (*rsa.PrivateKey, error)
ReadPrivateKeyFromFile reads and parses an RSA private key from a file
func ReadPublicKeyFromFile ¶
ReadPublicKeyFromFile reads and parses an RSA public key from a file
func WriteKeyPairToFiles ¶
func WriteKeyPairToFiles(privateKey *rsa.PrivateKey, privateKeyPath, publicKeyPath string) error
WriteKeyPairToFiles writes RSA key pair to files with specified permissions
Types ¶
This section is empty.