Documentation
¶
Index ¶
- func BytesFromOptionalString(value *string) []byte
- func CurveNameFromECDH(curve ecdh.Curve) (string, error)
- func DeriveECCAESKey(sharedSecret []byte, curveName string) ([]byte, error)
- func EncodeECCCipherPayload(payload ECCCipherPayload) (string, error)
- func IsLocalAESKey(key string) bool
- func ParseECDHPrivateKeyFromBase64(b64 string) (*ecdh.PrivateKey, error)
- func ParseECDHPrivateKeyFromPEMFile(path string) (*ecdh.PrivateKey, error)
- func ParseECDHPublicKeyFromBase64(b64 string) (*ecdh.PublicKey, error)
- func ParseECDHPublicKeyFromPEMFile(path string) (*ecdh.PublicKey, error)
- func ParseEd25519PrivateKeyFromBase64(b64 string) (ed25519.PrivateKey, error)
- func ParseEd25519PrivateKeyFromPEMFile(path string) (ed25519.PrivateKey, error)
- func ParseEd25519PublicKeyFromBase64(b64 string) (ed25519.PublicKey, error)
- func ParseEd25519PublicKeyFromPEMFile(path string) (ed25519.PublicKey, error)
- func ParseRSAPrivateKeyFromBase64(b64 string) (*rsa.PrivateKey, error)
- func ParseRSAPrivateKeyFromPEMFile(path string) (*rsa.PrivateKey, error)
- func ParseRSAPublicKeyFromBase64(b64 string) (*rsa.PublicKey, error)
- func ParseRSAPublicKeyFromPEMFile(path string) (*rsa.PublicKey, error)
- func ResolveECDHCurve(curve common.CurveAsymmetricKey) (ecdh.Curve, error)
- type ECCCipherPayload
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BytesFromOptionalString ¶
BytesFromOptionalString converts an optional string into a byte slice.
func CurveNameFromECDH ¶
CurveNameFromECDH returns the serialized name for the provided ECDH curve.
func DeriveECCAESKey ¶
DeriveECCAESKey derives a 256-bit AES key from an ECDH shared secret.
func EncodeECCCipherPayload ¶
func EncodeECCCipherPayload(payload ECCCipherPayload) (string, error)
EncodeECCCipherPayload serializes an ECC payload and returns it in Base64.
func IsLocalAESKey ¶
IsLocalAESKey reports whether key looks like a usable Base64-encoded AES key.
func ParseECDHPrivateKeyFromBase64 ¶
func ParseECDHPrivateKeyFromBase64(b64 string) (*ecdh.PrivateKey, error)
ParseECDHPrivateKeyFromBase64 decodes a Base64-encoded ECDH private key.
func ParseECDHPrivateKeyFromPEMFile ¶
func ParseECDHPrivateKeyFromPEMFile(path string) (*ecdh.PrivateKey, error)
ParseECDHPrivateKeyFromPEMFile decodes an ECDH private key from a PEM file.
func ParseECDHPublicKeyFromBase64 ¶
ParseECDHPublicKeyFromBase64 decodes a Base64-encoded ECDH public key.
func ParseECDHPublicKeyFromPEMFile ¶
ParseECDHPublicKeyFromPEMFile decodes an ECDH public key from a PEM file.
func ParseEd25519PrivateKeyFromBase64 ¶
func ParseEd25519PrivateKeyFromBase64(b64 string) (ed25519.PrivateKey, error)
ParseEd25519PrivateKeyFromBase64 decodes a Base64-encoded Ed25519 private key.
func ParseEd25519PrivateKeyFromPEMFile ¶
func ParseEd25519PrivateKeyFromPEMFile(path string) (ed25519.PrivateKey, error)
ParseEd25519PrivateKeyFromPEMFile decodes an Ed25519 private key from a PEM file.
func ParseEd25519PublicKeyFromBase64 ¶
ParseEd25519PublicKeyFromBase64 decodes a Base64-encoded Ed25519 public key.
func ParseEd25519PublicKeyFromPEMFile ¶
ParseEd25519PublicKeyFromPEMFile decodes an Ed25519 public key from a PEM file.
func ParseRSAPrivateKeyFromBase64 ¶
func ParseRSAPrivateKeyFromBase64(b64 string) (*rsa.PrivateKey, error)
ParseRSAPrivateKeyFromBase64 decodes a Base64-encoded RSA private key.
func ParseRSAPrivateKeyFromPEMFile ¶
func ParseRSAPrivateKeyFromPEMFile(path string) (*rsa.PrivateKey, error)
ParseRSAPrivateKeyFromPEMFile decodes an RSA private key from a PEM file.
func ParseRSAPublicKeyFromBase64 ¶
ParseRSAPublicKeyFromBase64 decodes a Base64-encoded RSA public key.
func ParseRSAPublicKeyFromPEMFile ¶
ParseRSAPublicKeyFromPEMFile decodes an RSA public key from a PEM file.
func ResolveECDHCurve ¶
func ResolveECDHCurve(curve common.CurveAsymmetricKey) (ecdh.Curve, error)
ResolveECDHCurve returns the Go ECDH curve for the provided enum.
Types ¶
type ECCCipherPayload ¶
type ECCCipherPayload struct {
Curve string `json:"curve"`
EphemeralPublicKey string `json:"ephemeralPublicKey"`
Ciphertext string `json:"ciphertext"`
}
ECCCipherPayload stores the envelope used by ECC hybrid encryption.
func DecodeECCCipherPayload ¶
func DecodeECCCipherPayload(cipherText string) (*ECCCipherPayload, error)
DecodeECCCipherPayload decodes an ECC payload from Base64.