Canonical Encoding Rules¶
-
pyasn1.codec.cer.encoder.
encode
(value)¶ A pyasn1 object to encode
- defMode:
bool
- If False, produces indefinite length encoding
- maxChunkSize:
int
- Maximum chunk size in chunked encoding mode (0 denotes unlimited chunk size)
Returns: bytes
(Python 3) orstr
(Python 2) – Given ASN.1 object encoded into BER octetstreamRaises: : :py:class:`pyasn1.error.PyAsn1Error` – On encoding errors - defMode:
-
pyasn1.codec.cer.decoder.
decode
(substrate, asn1Spec=None)¶ Turns CER octet stream into an ASN.1 object.
Takes CER octetstream and decode it into an ASN.1 object (e.g.
PyAsn1Item
derivative) which may be a scalar or an arbitrary nested structure.Parameters: - substrate (
bytes
(Python 3) orstr
(Python 2)) – CER octetstream - asn1Spec (any pyasn1 type object e.g.
PyAsn1Item
derivative) – A pyasn1 type object to act as a template guiding the decoder. Depending on the ASN.1 structure being decoded, asn1Spec may or may not be required. Most common reason for it to require is that ASN.1 structure is encoded in IMPLICIT tagging mode.
Returns: tuple
– A tuple of pyasn1 object recovered from CER substrate (PyAsn1Item
derivative) and the unprocessed trailing portion of the substrate (may be empty)Raises: : :py:class:`pyasn1.error.PyAsn1Error` – On decoding errors
- substrate (