Documentation ¶
Index ¶
- Constants
- func Decrypt(privateKey *PrivateKey, ephemeralPublicKey *PublicKey, ciphertext []byte) (encodedSessionKey []byte, err error)
- func EncodeFields(writer io.Writer, ephemeralPublicKey *PublicKey, encryptedSessionKey []byte, ...) (err error)
- func EncodedFieldsLength(encryptedSessionKey []byte, v6 bool) int
- func Validate(pk *PrivateKey) (err error)
- type PrivateKey
- type PublicKey
Constants ¶
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 ¶
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 ¶
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.