// Generated by Lisette bindgen
// Source: encoding/asn1 (Go stdlib)
// Go: 1.25.10
// Lisette: 0.2.1
/// Marshal returns the ASN.1 encoding of val.
///
/// In addition to the struct tags recognized by Unmarshal, the following can be
/// used:
///
/// ia5: causes strings to be marshaled as ASN.1, IA5String values
/// omitempty: causes empty slices to be skipped
/// printable: causes strings to be marshaled as ASN.1, PrintableString values
/// utf8: causes strings to be marshaled as ASN.1, UTF8String values
/// numeric: causes strings to be marshaled as ASN.1, NumericString values
/// utc: causes time.Time to be marshaled as ASN.1, UTCTime values
/// generalized: causes time.Time to be marshaled as ASN.1, GeneralizedTime values
pub fn Marshal(val: Unknown) -> Result<Slice<byte>, error>
/// MarshalWithParams allows field parameters to be specified for the
/// top-level element. The form of the params is the same as the field tags.
pub fn MarshalWithParams(val: Unknown, params: string) -> Result<Slice<byte>, error>
/// Unmarshal parses the DER-encoded ASN.1 data structure b
/// and uses the reflect package to fill in an arbitrary value pointed at by val.
/// Because Unmarshal uses the reflect package, the structs
/// being written to must use upper case field names. If val
/// is nil or not a pointer, Unmarshal returns an error.
///
/// After parsing b, any bytes that were leftover and not used to fill
/// val will be returned in rest. When parsing a SEQUENCE into a struct,
/// any trailing elements of the SEQUENCE that do not have matching
/// fields in val will not be included in rest, as these are considered
/// valid elements of the SEQUENCE and not trailing data.
///
/// - An ASN.1 INTEGER can be written to an int, int32, int64,
/// or *[big.Int].
/// If the encoded value does not fit in the Go type,
/// Unmarshal returns a parse error.
///
/// - An ASN.1 BIT STRING can be written to a [BitString].
///
/// - An ASN.1 OCTET STRING can be written to a []byte.
///
/// - An ASN.1 OBJECT IDENTIFIER can be written to an [ObjectIdentifier].
///
/// - An ASN.1 ENUMERATED can be written to an [Enumerated].
///
/// - An ASN.1 UTCTIME or GENERALIZEDTIME can be written to a [time.Time].
///
/// - An ASN.1 PrintableString, IA5String, or NumericString can be written to a string.
///
/// - Any of the above ASN.1 values can be written to an interface{}.
/// The value stored in the interface has the corresponding Go type.
/// For integers, that type is int64.
///
/// - An ASN.1 SEQUENCE OF x or SET OF x can be written
/// to a slice if an x can be written to the slice's element type.
///
/// - An ASN.1 SEQUENCE or SET can be written to a struct
/// if each of the elements in the sequence can be
/// written to the corresponding element in the struct.
///
/// The following tags on struct fields have special meaning to Unmarshal:
///
/// application specifies that an APPLICATION tag is used
/// private specifies that a PRIVATE tag is used
/// default:x sets the default value for optional integer fields (only used if optional is also present)
/// explicit specifies that an additional, explicit tag wraps the implicit one
/// optional marks the field as ASN.1 OPTIONAL
/// set causes a SET, rather than a SEQUENCE type to be expected
/// tag:x specifies the ASN.1 tag number; implies ASN.1 CONTEXT SPECIFIC
///
/// When decoding an ASN.1 value with an IMPLICIT tag into a string field,
/// Unmarshal will default to a PrintableString, which doesn't support
/// characters such as '@' and '&'. To force other encodings, use the following
/// tags:
///
/// ia5 causes strings to be unmarshaled as ASN.1 IA5String values
/// numeric causes strings to be unmarshaled as ASN.1 NumericString values
/// utf8 causes strings to be unmarshaled as ASN.1 UTF8String values
///
/// When decoding an ASN.1 value with an IMPLICIT tag into a time.Time field,
/// Unmarshal will default to a UTCTime, which doesn't support time zones or
/// fractional seconds. To force usage of GeneralizedTime, use the following
/// tag:
///
/// generalized causes time.Times to be unmarshaled as ASN.1 GeneralizedTime values
///
/// If the type of the first field of a structure is RawContent then the raw
/// ASN1 contents of the struct will be stored in it.
///
/// If the name of a slice type ends with "SET" then it's treated as if
/// the "set" tag was set on it. This results in interpreting the type as a
/// SET OF x rather than a SEQUENCE OF x. This can be used with nested slices
/// where a struct tag cannot be given.
///
/// Other ASN.1 types are not supported; if it encounters them,
/// Unmarshal returns a parse error.
pub fn Unmarshal(b: Slice<byte>, val: Unknown) -> Result<Slice<byte>, error>
/// UnmarshalWithParams allows field parameters to be specified for the
/// top-level element. The form of the params is the same as the field tags.
pub fn UnmarshalWithParams(b: Slice<byte>, val: Unknown, params: string) -> Result<Slice<byte>, error>
/// BitString is the structure to use when you want an ASN.1 BIT STRING type. A
/// bit string is padded up to the nearest byte in memory and the number of
/// valid bits is recorded. Padding bits will be zero.
pub struct BitString {
pub Bytes: Slice<byte>,
pub BitLength: int,
}
/// An Enumerated is represented as a plain int.
pub struct Enumerated(int)
/// A Flag accepts any data and is set to true if present.
pub struct Flag(bool)
/// An ObjectIdentifier represents an ASN.1 OBJECT IDENTIFIER.
pub struct ObjectIdentifier(Slice<int>)
/// RawContent is used to signal that the undecoded, DER data needs to be
/// preserved for a struct. To use it, the first field of the struct must have
/// this type. It's an error for any of the other fields to have this type.
pub struct RawContent(Slice<byte>)
/// A RawValue represents an undecoded ASN.1 object.
pub struct RawValue {
pub Class: int,
pub Tag: int,
pub IsCompound: bool,
pub Bytes: Slice<byte>,
pub FullBytes: Slice<byte>,
}
/// A StructuralError suggests that the ASN.1 data is valid, but the Go type
/// which is receiving it doesn't match.
pub struct StructuralError {
pub Msg: string,
}
/// A SyntaxError suggests that the ASN.1 data is invalid.
pub struct SyntaxError {
pub Msg: string,
}
/// ASN.1 class types represent the namespace of the tag.
pub const ClassApplication = 1
/// ASN.1 class types represent the namespace of the tag.
pub const ClassContextSpecific = 2
/// ASN.1 class types represent the namespace of the tag.
pub const ClassPrivate = 3
/// ASN.1 class types represent the namespace of the tag.
pub const ClassUniversal = 0
/// ASN.1 tags represent the type of the following object.
pub const TagBMPString = 30
/// ASN.1 tags represent the type of the following object.
pub const TagBitString = 3
/// ASN.1 tags represent the type of the following object.
pub const TagBoolean = 1
/// ASN.1 tags represent the type of the following object.
pub const TagEnum = 10
/// ASN.1 tags represent the type of the following object.
pub const TagGeneralString = 27
/// ASN.1 tags represent the type of the following object.
pub const TagGeneralizedTime = 24
/// ASN.1 tags represent the type of the following object.
pub const TagIA5String = 22
/// ASN.1 tags represent the type of the following object.
pub const TagInteger = 2
/// ASN.1 tags represent the type of the following object.
pub const TagNull = 5
/// ASN.1 tags represent the type of the following object.
pub const TagNumericString = 18
/// ASN.1 tags represent the type of the following object.
pub const TagOID = 6
/// ASN.1 tags represent the type of the following object.
pub const TagOctetString = 4
/// ASN.1 tags represent the type of the following object.
pub const TagPrintableString = 19
/// ASN.1 tags represent the type of the following object.
pub const TagSequence = 16
/// ASN.1 tags represent the type of the following object.
pub const TagSet = 17
/// ASN.1 tags represent the type of the following object.
pub const TagT61String = 20
/// ASN.1 tags represent the type of the following object.
pub const TagUTCTime = 23
/// ASN.1 tags represent the type of the following object.
pub const TagUTF8String = 12
/// NullBytes contains bytes representing the DER-encoded ASN.1 NULL type.
pub var NullBytes: Slice<byte>
/// NullRawValue is a [RawValue] with its Tag set to the ASN.1 NULL type tag (5).
pub var NullRawValue: RawValue
impl BitString {
/// At returns the bit at the given index. If the index is out of range it
/// returns 0.
fn At(self, i: int) -> int
/// RightAlign returns a slice where the padding bits are at the beginning. The
/// slice may share memory with the BitString.
fn RightAlign(self) -> Slice<byte>
}
impl ObjectIdentifier {
/// Equal reports whether oi and other represent the same identifier.
fn Equal(self, other: ObjectIdentifier) -> bool
fn String(self) -> string
}
impl StructuralError {
fn Error(self) -> string
}
impl SyntaxError {
fn Error(self) -> string
}