def print_cert(certificate): if not FLAGS.subject and not FLAGS.issuer and not FLAGS.fingerprint: if FLAGS.debug: print "%r" % certificate else: print certificate else: if FLAGS.subject: print "subject:\n%s" % certificate.print_subject_name() if FLAGS.issuer: print "issuer:\n%s" % certificate.print_issuer_name() if FLAGS.fingerprint: # Print in a format familiar from OpenSSL. print "%s fingerprint: %s\n" % ( FLAGS.digest.upper(), print_util.bytes_to_hex( certificate.fingerprint(hashfunc=FLAGS.digest)))
def print_cert(certificate): if not FLAGS.subject and not FLAGS.issuer and not FLAGS.fingerprint: if FLAGS.debug: print "%r" % certificate else: print certificate else: if FLAGS.subject: print "subject:\n%s" % certificate.print_subject_name() if FLAGS.issuer: print "issuer:\n%s" % certificate.print_issuer_name() if FLAGS.fingerprint: # Print in a format familiar from OpenSSL. print "%s fingerprint: %s\n" % (FLAGS.digest.upper(), print_util.bytes_to_hex( certificate.fingerprint( hashfunc=FLAGS.digest)))
def __str__(self): if self._decoded_value is not None: return str(self._decoded_value) return print_util.bytes_to_hex(self._value)
def __str__(self): return print_util.bytes_to_hex(self._value)
def test_bytes_to_hex(self): byte_array = "\x01\xae" self.assertEqual("01:ae", print_util.bytes_to_hex(byte_array)) self.assertEqual("01ae", print_util.bytes_to_hex(byte_array, delimiter="")) self.assertEqual("", print_util.bytes_to_hex(""))