How do I remove a field from a ASN.1 structure (pyasn1)?

128 Views Asked by At

Basically, I'm looking for something like this:

from pyasn1.codec.ber import decoder as ber_decoder
from pyasn1.codec.ber import encoder as ber_encoder

x, _ = ber_decoder.decode(data)
x.remove(2)  # remove the second field
result = ber_encoder.encode(x)

Except, obviously, no such function as remove exists in the class. del x[2] doesn't work either, because the __del__ function is not implemented.

0

There are 0 best solutions below