x448

package
v2.0.0-...-6e5629b Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2023 License: BSD-3-Clause Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const PointSize = 56

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(privateKey *PrivateKey, ephemeralPublicKey *PublicKey, ciphertext []byte) (encodedSessionKey []byte, err error)

Decrypt decrypts a session key stored in ciphertext with the provided x448 private key and ephemeral public key

func EncodeFields

func EncodeFields(writer io.Writer, ephemeralPublicKey *PublicKey, encryptedSessionKey []byte, cipherFunction byte, v6 bool) (err error)

EncodeField encodes x448 session key encryption as ephemeral x448 public key | follow byte length | cipherFunction (v3 only) | encryptedSessionKey and writes it to writer

func EncodedFieldsLength

func EncodedFieldsLength(encryptedSessionKey []byte, v6 bool) int

EncodeFieldsLength returns the length of the ciphertext encoding given the encrpyted session key.

func Validate

func Validate(pk *PrivateKey) (err error)

Validate validates that the provided public key matches the private key.

Types

type PrivateKey

type PrivateKey struct {
	PublicKey
	Secret []byte
}

func GenerateKey

func GenerateKey(rand io.Reader) (*PrivateKey, error)

GenerateKey generates a new x448 key pair

func NewPrivateKey

func NewPrivateKey(key PublicKey) *PrivateKey

type PublicKey

type PublicKey struct {
	Point []byte
}

func DecodeFields

func DecodeFields(reader io.Reader, v6 bool) (ephemeralPublicKey *PublicKey, encryptedSessionKey []byte, cipherFunction byte, err error)

DecodeField decodes a x448 session key encryption as ephemeral x448 public key | follow byte length | cipherFunction (v3 only) | encryptedSessionKey

func Encrypt

func Encrypt(rand io.Reader, publicKey *PublicKey, sessionKey []byte) (ephemeralPublicKey *PublicKey, encryptedSessionKey []byte, err error)

Encrypt encrpyts a sessionKey with x448 according to the OpenPGP crypto refresh specification section 5.1.6. The function assumes that the sessionKey has the correct format and padding according to the specification.

Jump to

Keyboard shortcuts

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