def read(self, istream): """ Read the data encoding the RevocationReason object and decode it into its constituent parts. Args: istream (Stream): A data stream containing encoded object data, supporting a read method; usually a BytearrayStream object. """ super(RevocationReason, self).read(istream) tstream = BytearrayStream(istream.read(self.length)) self.revocation_code = RevocationReasonCode() self.revocation_code.read(tstream) if self.is_tag_next(Tags.REVOCATION_MESSAGE, tstream): self.revocation_message = TextString() self.revocation_message.read(tstream) self.is_oversized(tstream) self.validate()
def __init__(self, code=None, message=None): """ Construct a RevocationReason object. Parameters: code(RevocationReasonCode): revocation reason code message(string): An optional revocation message """ super(RevocationReason, self).__init__(tag=Tags.REVOCATION_REASON) if code is not None: self.revocation_code = RevocationReasonCode(value=code) else: self.revocation_code = RevocationReasonCode() if message is not None: self.revocation_message = TextString(value=message, tag=Tags.REVOCATION_MESSAGE) else: self.revocation_message = None self.validate()