utilities

package
v0.0.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 10, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesFromOptionalString

func BytesFromOptionalString(value *string) []byte

BytesFromOptionalString converts an optional string into a byte slice.

func CurveNameFromECDH

func CurveNameFromECDH(curve ecdh.Curve) (string, error)

CurveNameFromECDH returns the serialized name for the provided ECDH curve.

func DeriveECCAESKey

func DeriveECCAESKey(sharedSecret []byte, curveName string) ([]byte, error)

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

func IsLocalAESKey(key string) bool

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

func ParseECDHPublicKeyFromBase64(b64 string) (*ecdh.PublicKey, error)

ParseECDHPublicKeyFromBase64 decodes a Base64-encoded ECDH public key.

func ParseECDHPublicKeyFromPEMFile

func ParseECDHPublicKeyFromPEMFile(path string) (*ecdh.PublicKey, error)

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

func ParseEd25519PublicKeyFromBase64(b64 string) (ed25519.PublicKey, error)

ParseEd25519PublicKeyFromBase64 decodes a Base64-encoded Ed25519 public key.

func ParseEd25519PublicKeyFromPEMFile

func ParseEd25519PublicKeyFromPEMFile(path string) (ed25519.PublicKey, error)

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

func ParseRSAPublicKeyFromBase64(b64 string) (*rsa.PublicKey, error)

ParseRSAPublicKeyFromBase64 decodes a Base64-encoded RSA public key.

func ParseRSAPublicKeyFromPEMFile

func ParseRSAPublicKeyFromPEMFile(path string) (*rsa.PublicKey, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL