package encoding
import "github.com/ProtonMail/go-crypto/openpgp/internal/encoding"
Package encoding implements openpgp packet field encodings as specified in RFC 4880 and 6637.
Index ¶
- type Field
- type MPI
- func NewMPI(bytes []byte) *MPI
- func (m *MPI) BitLength() uint16
- func (m *MPI) Bytes() []byte
- func (m *MPI) EncodedBytes() []byte
- func (m *MPI) EncodedLength() uint16
- func (m *MPI) ReadFrom(r io.Reader) (int64, error)
- func (m *MPI) SetBig(n *big.Int) *MPI
- type OID
- func NewOID(bytes []byte) *OID
- func (o *OID) BitLength() uint16
- func (o *OID) Bytes() []byte
- func (o *OID) EncodedBytes() []byte
- func (o *OID) EncodedLength() uint16
- func (o *OID) ReadFrom(r io.Reader) (int64, error)
- type OctetArray
- func NewEmptyOctetArray(length int) *OctetArray
- func NewOctetArray(bytes []byte) *OctetArray
- func (o *OctetArray) BitLength() uint16
- func (o *OctetArray) Bytes() []byte
- func (o *OctetArray) EncodedBytes() []byte
- func (o *OctetArray) EncodedLength() uint16
- func (o *OctetArray) ReadFrom(r io.Reader) (int64, error)
- type ShortByteString
- func NewShortByteString(data []byte) *ShortByteString
- func (byteString *ShortByteString) BitLength() uint16
- func (byteString *ShortByteString) Bytes() []byte
- func (byteString *ShortByteString) EncodedBytes() []byte
- func (byteString *ShortByteString) EncodedLength() uint16
- func (byteString *ShortByteString) ReadFrom(r io.Reader) (int64, error)
Types ¶
type Field ¶
type Field interface {
// Bytes returns the decoded data.
Bytes() []byte
// BitLength is the size in bits of the decoded data.
BitLength() uint16
// EncodedBytes returns the encoded data.
EncodedBytes() []byte
// EncodedLength is the size in bytes of the encoded data.
EncodedLength() uint16
// ReadFrom reads the next Field from r.
ReadFrom(r io.Reader) (int64, error)
}
Field is an encoded field of an openpgp packet.
type MPI ¶
type MPI struct {
// contains filtered or unexported fields
}
An MPI is used to store the contents of a big integer, along with the bit length that was specified in the original input. This allows the MPI to be reserialized exactly.
func NewMPI ¶
NewMPI returns a MPI initialized with bytes.
func (*MPI) BitLength ¶
BitLength is the size in bits of the decoded data.
func (*MPI) Bytes ¶
Bytes returns the decoded data.
func (*MPI) EncodedBytes ¶
EncodedBytes returns the encoded data.
func (*MPI) EncodedLength ¶
EncodedLength is the size in bytes of the encoded data.
func (*MPI) ReadFrom ¶
ReadFrom reads into m the next MPI from r.
func (*MPI) SetBig ¶
SetBig initializes m with the bits from n.
type OID ¶
type OID struct {
// contains filtered or unexported fields
}
OID is used to store a variable-length field with a one-octet size prefix. See https://tools.ietf.org/html/rfc6637#section-9.
func NewOID ¶
NewOID returns a OID initialized with bytes.
func (*OID) BitLength ¶
BitLength is the size in bits of the decoded data.
func (*OID) Bytes ¶
Bytes returns the decoded data.
func (*OID) EncodedBytes ¶
EncodedBytes returns the encoded data.
func (*OID) EncodedLength ¶
EncodedLength is the size in bytes of the encoded data.
func (*OID) ReadFrom ¶
ReadFrom reads into b the next OID from r.
type OctetArray ¶
type OctetArray struct {
// contains filtered or unexported fields
}
OctetArray is used to store a fixed-length field
func NewEmptyOctetArray ¶
func NewEmptyOctetArray(length int) *OctetArray
func NewOctetArray ¶
func NewOctetArray(bytes []byte) *OctetArray
NewOctetArray returns a OID initialized with bytes.
func (*OctetArray) BitLength ¶
func (o *OctetArray) BitLength() uint16
BitLength is the size in bits of the decoded data.
func (*OctetArray) Bytes ¶
func (o *OctetArray) Bytes() []byte
Bytes returns the decoded data.
func (*OctetArray) EncodedBytes ¶
func (o *OctetArray) EncodedBytes() []byte
EncodedBytes returns the encoded data.
func (*OctetArray) EncodedLength ¶
func (o *OctetArray) EncodedLength() uint16
EncodedLength is the size in bytes of the encoded data.
func (*OctetArray) ReadFrom ¶
func (o *OctetArray) ReadFrom(r io.Reader) (int64, error)
ReadFrom reads into b the next OID from r.
type ShortByteString ¶
type ShortByteString struct {
// contains filtered or unexported fields
}
func NewShortByteString ¶
func NewShortByteString(data []byte) *ShortByteString
func (*ShortByteString) BitLength ¶
func (byteString *ShortByteString) BitLength() uint16
func (*ShortByteString) Bytes ¶
func (byteString *ShortByteString) Bytes() []byte
func (*ShortByteString) EncodedBytes ¶
func (byteString *ShortByteString) EncodedBytes() []byte
func (*ShortByteString) EncodedLength ¶
func (byteString *ShortByteString) EncodedLength() uint16
func (*ShortByteString) ReadFrom ¶
func (byteString *ShortByteString) ReadFrom(r io.Reader) (int64, error)
Source Files ¶
encoding.go mpi.go octetarray.go oid.go short_byte_string.go
- Version
- v1.1.3-proton.2
- Published
- Dec 5, 2024
- Platform
- js/wasm
- Imports
- 4 packages
- Last checked
- 1 hour ago –
Tools for package owners.