Documentation ¶
Index ¶
- func AsECDSAStr(privateKey *ecdsa.PrivateKey, publicKey *ecdsa.PublicKey) (string, string, error)
- func AsRSAStr(privateKey *rsa.PrivateKey, publickKey *rsa.PublicKey) (string, string, error)
- func DecryptAES(text string) (string, error)
- func DecryptAESEnv(ciphertext []byte) ([]byte, error)
- func DecryptB64(s string) (string, error)
- func DecryptRSA(cipherText string, privateKey rsa.PrivateKey) (string, error)
- func EncryptAES(text string) (string, error)
- func EncryptAESEnv(text []byte) ([]byte, error)
- func EncryptB64(text string) string
- func EncryptEnvData(data map[string]interface{}) (string, error)
- func EncryptPassword(password string) (string, error)
- func EncryptRSA(message string, key rsa.PublicKey) (string, error)
- func ExportEcdsaPrivateKeyAsPemStr(privkey *ecdsa.PrivateKey) (string, error)
- func ExportEcdsaPublicKeyAsPemStr(pubkey *ecdsa.PublicKey) (string, error)
- func ExportRsaPrivateKeyAsPemStr(privkey *rsa.PrivateKey) string
- func ExportRsaPublicKeyAsPemStr(pubkey *rsa.PublicKey) string
- func GenerateJWKBasedOnEnv() (string, error)
- func GetPubJWK(algo, keyID string, publicKey interface{}) (string, error)
- func IsECDSA(algo string) bool
- func IsHMACA(algo string) bool
- func IsRSA(algo string) bool
- func NewECDSAKey(algo, keyID string) (*ecdsa.PrivateKey, string, string, string, error)
- func NewHMACKey(algo, keyID string) (string, string, error)
- func NewRSAKey(algo, keyID string) (*rsa.PrivateKey, string, string, string, error)
- func ParseEcdsaPrivateKeyFromPemStr(privPEM string) (*ecdsa.PrivateKey, error)
- func ParseEcdsaPublicKeyFromPemStr(pubPEM string) (*ecdsa.PublicKey, error)
- func ParseRsaPrivateKeyFromPemStr(privPEM string) (*rsa.PrivateKey, error)
- func ParseRsaPublicKeyFromPemStr(pubPEM string) (*rsa.PublicKey, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AsECDSAStr ¶
AsECDSAStr returns private, public key string or error
func DecryptAES ¶
DecryptAES method is to extract back the encrypted text
func DecryptAESEnv ¶
DecryptAES decrypts data using AES algorithm Kept for the backward compatibility of env data decryption
func DecryptB64 ¶
DecryptB64 decrypts from base64 string to readable string
func DecryptRSA ¶
func DecryptRSA(cipherText string, privateKey rsa.PrivateKey) (string, error)
func EncryptAES ¶
EncryptAES method is to encrypt or hide any classified text
func EncryptAESEnv ¶
EncryptAESEnv encrypts data using AES algorithm kept for the backward compatibility of env data encryption
func EncryptEnvData ¶
EncryptEnvData is used to encrypt the env data
func EncryptPassword ¶
EncryptPassword is used for encrypting password
func ExportEcdsaPrivateKeyAsPemStr ¶
func ExportEcdsaPrivateKeyAsPemStr(privkey *ecdsa.PrivateKey) (string, error)
ExportEcdsaPrivateKeyAsPemStr to get ECDSA private key as pem string
func ExportEcdsaPublicKeyAsPemStr ¶
ExportEcdsaPublicKeyAsPemStr to get ECDSA public key as pem string
func ExportRsaPrivateKeyAsPemStr ¶
func ExportRsaPrivateKeyAsPemStr(privkey *rsa.PrivateKey) string
ExportRsaPrivateKeyAsPemStr to get RSA private key as pem string
func ExportRsaPublicKeyAsPemStr ¶
ExportRsaPublicKeyAsPemStr to get RSA public key as pem string
func GenerateJWKBasedOnEnv ¶
GenerateJWKBasedOnEnv generates JWK based on env make sure clientID, jwtType, jwtSecret / public & private key pair is set this is called while initializing app / when env is updated
func NewECDSAKey ¶
NewECDSAKey to generate new ECDSA Key if env is not set returns key instance, private key string, public key string, jwk string, error
func NewHMACKey ¶
NewHMAC key returns new key that can be used to ecnrypt data using HMAC algo returns key, string, error
func NewRSAKey ¶
NewRSAKey to generate new RSA Key if env is not set returns key instance, private key string, public key string, jwk string, error
func ParseEcdsaPrivateKeyFromPemStr ¶
func ParseEcdsaPrivateKeyFromPemStr(privPEM string) (*ecdsa.PrivateKey, error)
ParseEcdsaPrivateKeyFromPemStr to parse ECDSA private key from pem string
func ParseEcdsaPublicKeyFromPemStr ¶
ParseEcdsaPublicKeyFromPemStr to parse ECDSA public key from pem string
func ParseRsaPrivateKeyFromPemStr ¶
func ParseRsaPrivateKeyFromPemStr(privPEM string) (*rsa.PrivateKey, error)
ParseRsaPrivateKeyFromPemStr to parse RSA private key from pem string
Types ¶
This section is empty.