MCPcopy Create free account
hub / github.com/mozilla/cipherscan / CertificateStatus

Class CertificateStatus

cscan/messages.py:175–200  ·  view source on GitHub ↗

Class for handling the CertificateStatus OCSP staples from RFC 4366.

Source from the content-addressed store, hash-verified

173
174
175class CertificateStatus(messages.HandshakeMsg):
176 """Class for handling the CertificateStatus OCSP staples from RFC 4366."""
177
178 def __init__(self):
179 """Create a certificate status message handling object."""
180 super(CertificateStatus, self).__init__(
181 HandshakeType.certificate_status)
182 self.status_type = 0
183 self.response = None
184
185 def parse(self, parser):
186 """Deserialise certificate status message from binary data."""
187 parser.startLengthCheck(3)
188 self.status_type = parser.get(1)
189 if self.status_type == 1: # FIXME, create registry
190 self.response = parser.getVarBytes(3)
191 else:
192 raise SyntaxError() # FIXME, use sane-er type
193 parser.stopLengthCheck()
194 return self
195
196 def __format__(self, formatstr):
197 """Return human-readable representation of certificate status."""
198 response = format_bytearray(self.response, formatstr)
199 return "CertificateStatus(status_type={0}, response={1})"\
200 .format(self.status_type, response)
201
202
203class Message(messages.Message):

Callers 1

parseMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected