Esempio n. 1
0
                        try:
                            uuidO = uuid.UUID(fields=uuidarg)
                        except:
                            try:
                                uuidO = uuid.UUID(bytes=uuidarg)
                            except:
                                try:
                                    uuidO = uuid.UUID(bytes_le=uuidarg)
                                except:
                                    pass
        if uuidO is not None:
            uuidI = uuidO.int

    newgid = GID(create=True, subject=subject, uuid=uuidI, urn=urn, lifeDays=lifeDays)
    if email:
        newgid.set_email(email)
    
    if public_key is None:
        # create a new key pair
        keys = Keypair(create=True)
    else:
        # use the specified public key file
        keys = Keypair()
        keys.load_pubkey_from_file(public_key)
    newgid.set_pubkey(keys)
    newgid.set_is_ca(ca)

    if issuer_key and issuer_cert:
        # the given issuer will issue this cert
        if isinstance(issuer_key,str):
            issuer_key = Keypair(filename=issuer_key)
Esempio n. 2
0
                                uuidO = uuid.UUID(bytes=uuidarg)
                            except:
                                try:
                                    uuidO = uuid.UUID(bytes_le=uuidarg)
                                except:
                                    pass
        if uuidO is not None:
            uuidI = uuidO.int

    newgid = GID(create=True,
                 subject=subject,
                 uuid=uuidI,
                 urn=urn,
                 lifeDays=lifeDays)
    if email:
        newgid.set_email(email)

    if public_key is None:
        # create a new key pair
        keys = Keypair(create=True)
    else:
        # use the specified public key file
        keys = Keypair()
        keys.load_pubkey_from_file(public_key)
    newgid.set_pubkey(keys)
    newgid.set_is_ca(ca)

    if issuer_key and issuer_cert:
        # the given issuer will issue this cert
        if isinstance(issuer_key, str):
            issuer_key = Keypair(filename=issuer_key)