def extract(input, output):
    """Extract public key from private key.

    Given INPUT a private paillier key file as generated by generate, extract the
    public key portion to OUTPUT.

    Use "-" to output to stdout.
    """
    log("Loading paillier keypair")
    priv = json.load(input)
    error_msg = "Invalid private key"
    assert 'pub' in priv, error_msg
    assert priv['kty'] == 'DAJ', error_msg
    json.dump(priv['pub'], output)
    output.write('\n')
    log("Public key written to {}".format(output.name))
def extract ( input , output ) : log ( "Loading paillier keypair" ) priv = json . load ( input ) error_msg = "Invalid private key" assert 'pub' in priv , error_msg assert priv [ 'kty' ] == 'DAJ' , error_msg json . dump ( priv [ 'pub' ] , output ) output . write ( '\n' ) log ( "Public key written to {}" . format ( output . name ) )
Extract public key from private key.

    Given INPUT a private paillier key file as generated by generate, extract the
    public key portion to OUTPUT.

    Use "-" to output to stdout.