Exemplo n.º 1
0
def GetKeyHash(c):
    rid = rfc2560.ResponderID()
    spk = c[0].getComponentByName('tbsCertificate').getComponentByName(
        'subjectPublicKeyInfo').getComponentByName('subjectPublicKey')
    keyHash = hashlib.sha1(encoder.encode(spk)[4:]).digest()
    rid.setComponentByName('byKey', keyHash)
    return rid
Exemplo n.º 2
0
def GetName(c):
    rid = rfc2560.ResponderID()
    subject = c[0].getComponentByName('tbsCertificate').getComponentByName(
        'subject')
    rn = rid.componentType.getTypeByPosition(0).clone()
    for i in range(len(subject)):
        rn.setComponentByPosition(i, subject.getComponentByPosition(i))
    rid.setComponentByName('byName', rn)
    return rid