Documentation ¶
Index ¶
- func DecryptUsingSymmKey(encryptedMsg, privKey []byte) ([]byte, error)
- func EncryptUsingSymmKey(msg, privKey []byte) ([]byte, error)
- func ExportRsaPrivateKeyAsPemStr(privkey *rsa.PrivateKey) string
- func ExportRsaPrivateKeyToFile(fileName string, key *rsa.PrivateKey) error
- func ExportRsaPublicKeyAsPemStr(pubkey *rsa.PublicKey) string
- func ExportRsaPublicKeyToFile(fileName string, key *rsa.PublicKey) error
- func GenerateRsaKeyPair() (*rsa.PrivateKey, *rsa.PublicKey)
- func GetHash(msg []byte) []byte
- func ParseRsaPrivateKeyFromFile(fileName string) (*rsa.PrivateKey, error)
- func ParseRsaPrivateKeyFromPemStr(privPEM string) (*rsa.PrivateKey, error)
- func ParseRsaPublicKeyFromPemStr(pubPEM string) (*rsa.PublicKey, error)
- func Sign(msg []byte, key *rsa.PrivateKey) (signature []byte, err error)
- func Verify(msg []byte, sig []byte, pk *rsa.PublicKey) error
- type KeyStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecryptUsingSymmKey ¶
DecryptUsingSymmKey Decrypts data using ChaCha2020 TODO: Give option to change encryption algo
func EncryptUsingSymmKey ¶
EncryptUsingSymmKey Enrypts data using ChaCha2020 TODO: Give option to change encryption algo
func ExportRsaPrivateKeyAsPemStr ¶
func ExportRsaPrivateKeyAsPemStr(privkey *rsa.PrivateKey) string
ExportRsaPrivateKeyAsPemStr exports the rsa priv key in pem format
func ExportRsaPrivateKeyToFile ¶
func ExportRsaPrivateKeyToFile(fileName string, key *rsa.PrivateKey) error
ExportRsaPrivateKeyToFile exports the rsa priv key to a file
func ExportRsaPublicKeyAsPemStr ¶
ExportRsaPublicKeyAsPemStr exports the rsa pub key in pem format
func ExportRsaPublicKeyToFile ¶
ExportRsaPublicKeyToFile exports the rsa pub key to a file
func GenerateRsaKeyPair ¶
func GenerateRsaKeyPair() (*rsa.PrivateKey, *rsa.PublicKey)
GenerateRsaKeyPair generates a pub/priv rsa key pair
func ParseRsaPrivateKeyFromFile ¶
func ParseRsaPrivateKeyFromFile(fileName string) (*rsa.PrivateKey, error)
ParseRsaPrivateKeyFromFile parses the priv key from the given file
func ParseRsaPrivateKeyFromPemStr ¶
func ParseRsaPrivateKeyFromPemStr(privPEM string) (*rsa.PrivateKey, error)
ParseRsaPrivateKeyFromPemStr parses the private key from the given pem string
func ParseRsaPublicKeyFromPemStr ¶
ParseRsaPublicKeyFromPemStr parses the pub key from the given pem string
Types ¶
type KeyStore ¶
type KeyStore struct {
// contains filtered or unexported fields
}
KeyStore is a as the name says a keystore which stores multiple privatekeys
func (*KeyStore) AddKeyFromFile ¶
AddKeyFromFile Adds a private rsa key to the keystore from the file