1) By get the bytes I assume you mean for the private value? In that case,
key.private_numbers().private_value will give you it as an integer, then
you can encode it as you like.
2) No, EC private keys do not mathetmatically support encryption. If you
want to encrypt with an elliptic curve private key, you need to do
implement an ECIES scheme where you perform an ECDH exchange with another
key and then encrypt under a key derived from the shared secret.

Alex

On Wed, Dec 12, 2018 at 4:55 PM Prashanth Ravindran <
prashanthravind...@gmail.com> wrote:

> Hi,
>
> I am trying to implement private set intersection using the cryptography
> library, and I would like to take the bytes of a private key and do a
> hash(key_material, message).
>
> 1) How do I get the bytes for an instance of
> cryptography.hazmat.backends.openssl.ec._EllipticCurvePrivateKey
> 2) Is there any way of encrypting a message using the above private key.
>
> Thanks,
> Prashanth
>
> _______________________________________________
> Cryptography-dev mailing list
> Cryptography-dev@python.org
> https://mail.python.org/mailman/listinfo/cryptography-dev
>


-- 
All that is necessary for evil to succeed is for good people to do nothing.
_______________________________________________
Cryptography-dev mailing list
Cryptography-dev@python.org
https://mail.python.org/mailman/listinfo/cryptography-dev

Reply via email to