def sign(idText, request, caPrivkey):
    """
    A certificate authority (CA) generates an implicit certificate using 
    identity string @id, @request (certificate public key component), and 
    the CA's private key @caPrivkey.
    @returns (s, cert) where @r is the private key contribution and @cert is 
     the implicit certificate.
    """
    # Verify input types
    assertType(request, ec1Element)
    assertScalarType(caPrivkey)

    # Switch to new notation
    R = request
    d = caPrivkey
    G = generatorEc()
    N = orderEc()

    # TODO: use simultaneous mul to speed this up.
    # Random integer
    k = randomZ(N)
    P = R + k*G

    # Hash the identity string and implicit cert into an integer
    e = _exp(P, idText)

    # Compute the private key contribution
    r = (e*k + d) % N
    return (r, P)
A certificate authority (CA) generates an implicit certificate using 
    identity string @id, @request (certificate public key component), and 
    the CA's private key @caPrivkey.
    @returns (s, cert) where @r is the private key contribution and @cert is 
     the implicit certificate.