Documentation
¶
Index ¶
- Constants
- func BytesToEcdsaPrivateKey(priv []byte) (*ecdsa.PrivateKey, error)
- func BytesToEcdsaPublicKey(pub []byte) (*ecdsa.PublicKey, error)
- func BytesToEd25519PrivateKey(priv []byte) (*ed25519.PrivateKey, error)
- func BytesToEd25519PublicKey(pub []byte) (*ed25519.PublicKey, error)
- func BytesToRsaPrivateKey(priv []byte) (*rsa.PrivateKey, error)
- func BytesToRsaPublicKey(pub []byte) (*rsa.PublicKey, error)
- func DecryptWithKms(ctx context.Context, data []byte, project, location, keyring, key string) ([]byte, error)
- func EcdsaPrivateKeyToBytes(priv *ecdsa.PrivateKey) ([]byte, error)
- func EcdsaPublicKeyToBytes(pub *ecdsa.PublicKey) ([]byte, error)
- func Ed25519PrivateKeyToBytes(priv *ed25519.PrivateKey) ([]byte, error)
- func Ed25519PublicKeyToBytes(pub *ed25519.PublicKey) ([]byte, error)
- func EncryptWithKms(ctx context.Context, data []byte, project, location, keyring, key string) ([]byte, error)
- func NewAesKey() ([]byte, error)
- func NewEcdsaKeyPair(pubkeyCurve elliptic.Curve) (*ecdsa.PrivateKey, *ecdsa.PublicKey, error)
- func NewEd25519KeyPair() (*ed25519.PrivateKey, *ed25519.PublicKey, error)
- func NewRsaKeyPair(bits int) (*rsa.PrivateKey, *rsa.PublicKey, error)
- func RsaPrivateKeyToBytes(priv *rsa.PrivateKey) []byte
- func RsaPublicKeyToBytes(pub *rsa.PublicKey) ([]byte, error)
Constants ¶
const (
DefaultBits2048 = 2048
)
Variables ¶
This section is empty.
Functions ¶
func BytesToEcdsaPrivateKey ¶
func BytesToEcdsaPrivateKey(priv []byte) (*ecdsa.PrivateKey, error)
BytesToEcdsaPrivateKey bytes to private key
func BytesToEcdsaPublicKey ¶
BytesToEcdsaPublicKey bytes to public key
func BytesToEd25519PrivateKey ¶
func BytesToEd25519PrivateKey(priv []byte) (*ed25519.PrivateKey, error)
BytesToEd25519PrivateKey bytes to private key
func BytesToEd25519PublicKey ¶
BytesToEd25519PublicKey bytes to public key
func BytesToRsaPrivateKey ¶
func BytesToRsaPrivateKey(priv []byte) (*rsa.PrivateKey, error)
BytesToRsaPrivateKey bytes to private key
func BytesToRsaPublicKey ¶
BytesToRsaPublicKey bytes to public key
func DecryptWithKms ¶
func DecryptWithKms(ctx context.Context, data []byte, project, location, keyring, key string) ([]byte, error)
DecryptWithKms decrypts input data using Google KMS. You must have a service account referenced by env. var. GOOGLE_APPLICATION_CREDENTIALS
func EcdsaPrivateKeyToBytes ¶
func EcdsaPrivateKeyToBytes(priv *ecdsa.PrivateKey) ([]byte, error)
EcdsaPrivateKeyToBytes private key to bytes
func EcdsaPublicKeyToBytes ¶
EcdsaPublicKeyToBytes public key to bytes
func Ed25519PrivateKeyToBytes ¶
func Ed25519PrivateKeyToBytes(priv *ed25519.PrivateKey) ([]byte, error)
Ed25519PrivateKeyToBytes private key to bytes
func Ed25519PublicKeyToBytes ¶
Ed25519PublicKeyToBytes public key to bytes
func EncryptWithKms ¶
func EncryptWithKms(ctx context.Context, data []byte, project, location, keyring, key string) ([]byte, error)
EncryptWithKms encrypts input data using Google KMS. You must have a service account referenced by env. var. GOOGLE_APPLICATION_CREDENTIALS
func NewEcdsaKeyPair ¶
NewEcdsaKeyPair generates a new ECDSA key pair
func NewEd25519KeyPair ¶
func NewEd25519KeyPair() (*ed25519.PrivateKey, *ed25519.PublicKey, error)
NewEd25519KeyPair generates a new Ed25519 key pair
func NewRsaKeyPair ¶
NewRsaKeyPair generates a new RSA key pair
func RsaPrivateKeyToBytes ¶
func RsaPrivateKeyToBytes(priv *rsa.PrivateKey) []byte
RsaPrivateKeyToBytes private key to bytes
Types ¶
This section is empty.