pyca / cryptography

cryptography is a package designed to expose cryptographic primitives and recipes to Python developers.
https://cryptography.io
Other
6.44k stars 1.48k forks source link

Is there a HKDF-extract-only interface? #10255

Closed polaris846 closed 5 months ago

polaris846 commented 6 months ago

Hello, I'm writing a script and need to implement HPKE (RFC 9180 Hybrid Public Key Encryption). It requires a HKDF-extract-only interface and a HKDF-expand-only interface. However, I only find cryptography.hazmat.primitives.kdf.hkdf.HKDFExpand.

Is there a HKDF-extract-only interface, like HKDFExtract? Or I should use hmac to do that?

alex commented 6 months ago

There is not currently.

On Wed, Jan 24, 2024 at 11:03 PM zzwpolaris @.***> wrote:

Hello, I'm writing a script and need to implement HPKE (RFC 9180 Hybrid Public Key Encryption). It requires a HKDF-extract-only interface and a HKDF-expand-only interface. However, I only find cryptography.hazmat.primitives.kdf.hkdf.HKDFExpand.

Is there a HKDF-extract-only interface? like HKDFExtract?

— Reply to this email directly, view it on GitHub https://github.com/pyca/cryptography/issues/10255, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAAGBGGU2E6EJS5ST3DMXLYQHKSHAVCNFSM6AAAAABCJ25PPGVHI2DSMVQWIX3LMV43ASLTON2WKOZSGA4TSNJSGIYTCMI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- All that is necessary for evil to succeed is for good people to do nothing.

reaperhulk commented 6 months ago

HDKF Extract is extremely simple (other than making sure you handle the case where there's no salt provided) so I'd probably just implement it with the stdlib hmac

polaris846 commented 5 months ago

ok, I will use hmac. Thanks