Ejemplo n.º 1
0
    def _fixsig(self, cert):
        subject = 'CN=' + subject_from_certificate(cert)

        if subject in FIXSIG:  # Set unused bits in signature to 0
            der = cert.public_bytes(Encoding.DER)
            der = der[:-257] + b'\x00' + der[-256:]
            cert = certificate_from_der(der)
        return cert
Ejemplo n.º 2
0
    def _fixsig(self, cert):
        subject = 'CN=' + subject_from_certificate(cert)

        if subject in FIXSIG:  # Set unused bits in signature to 0
            der = list(cert.public_bytes(Encoding.DER))
            der[-257] = chr(0)
            cert = certificate_from_der(der)
        return cert
Ejemplo n.º 3
0
    def _fixsig(self, cert):
        subject = 'CN=' + subject_from_certificate(cert)

        if subject in FIXSIG:  # Set unused bits in signature to 0
            der = list(cert.public_bytes(Encoding.DER))
            der[-257] = b'\x00'
            cert = certificate_from_der(der)
        return cert
Ejemplo n.º 4
0
    def __init__(self, app_param, chal_param, data):
        self.app_param = app_param
        self.chal_param = chal_param
        self.data = data

        if byte2int(data[0]) != 0x05:
            raise ValueError("Invalid data: %r" % (data,))

        data = data[1:]
        self.pub_key = data[:self.PUBKEY_LEN]

        data = data[self.PUBKEY_LEN:]

        kh_len = byte2int(data[0])
        data = data[1:]

        self.key_handle = data[:kh_len]
        data = data[kh_len:]

        self.certificate = self._fixsig(certificate_from_der(data))
        self.signature = data[len(self.certificate.public_bytes(Encoding.DER)):]
Ejemplo n.º 5
0
    def __init__(self, app_param, chal_param, data):
        self.app_param = app_param
        self.chal_param = chal_param
        self.data = data

        if byte2int(data[0]) != 0x05:
            raise ValueError("Invalid data: %r" % (data,))

        data = data[1:]
        self.pub_key = data[:self.PUBKEY_LEN]

        data = data[self.PUBKEY_LEN:]

        kh_len = byte2int(data[0])
        data = data[1:]

        self.key_handle = data[:kh_len]
        data = data[kh_len:]

        self.certificate = self._fixsig(certificate_from_der(data))
        self.signature = data[len(self.certificate.public_bytes(Encoding.DER)):]