crypto: remove ECPrivateKey
There are no remaining users of it.
Bug: 425863216
Change-Id: I96c585c6d2158c3eb7ed6aa2e594fe475f8a7d0c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6766336
Reviewed-by: David Benjamin <davidben@chromium.org>
Reviewed-by: Hira Mahmood <hiramahmood@google.com>
Commit-Queue: Elly FJ <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1491506}
NOKEYCHECK=True
GitOrigin-RevId: 2976abe4f5fc74f9c33e43ce4a9b52bb48ccbf92
4 files changed
tree: d9b9db434a5c5908c679ada8671cfb0343963707
- apple/
- obsolete/
- aead.cc
- aead.h
- aead_unittest.cc
- aes_cbc.cc
- aes_cbc.h
- aes_cbc_unittest.cc
- aes_ctr.cc
- aes_ctr.h
- aes_ctr_unittest.cc
- BUILD.gn
- chaps_support.cc
- chaps_support.h
- crypto_export.h
- DEPS
- DIR_METADATA
- evp.cc
- evp.h
- evp_unittest.cc
- features.cc
- features.gni
- features.h
- hash.cc
- hash.h
- hash_unittest.cc
- hkdf.cc
- hkdf.h
- hmac.cc
- hmac.h
- hmac_unittest.cc
- kdf.cc
- kdf.h
- kdf_unittest.cc
- keypair.cc
- keypair.h
- keypair_unittest.cc
- mac_security_services_lock.cc
- mac_security_services_lock.h
- nss_crypto_module_delegate.h
- nss_key_util.cc
- nss_key_util.h
- nss_key_util_unittest.cc
- nss_util.cc
- nss_util.h
- nss_util_chromeos.cc
- nss_util_internal.h
- nss_util_unittest.cc
- openssl_util.cc
- openssl_util.h
- OWNERS
- PLAN.md
- process_bound_string.cc
- process_bound_string.h
- process_bound_string_unittest.cc
- random.cc
- random.h
- random_unittest.cc
- README.md
- rsa_private_key.cc
- rsa_private_key.h
- rsa_private_key_unittest.cc
- scoped_capi_types.h
- scoped_cng_types.h
- scoped_fake_unexportable_key_provider.cc
- scoped_fake_unexportable_key_provider.h
- scoped_fake_user_verifying_key_provider.cc
- scoped_fake_user_verifying_key_provider.h
- scoped_lacontext.h
- scoped_lacontext.mm
- scoped_nss_types.h
- scoped_test_nss_chromeos_user.cc
- scoped_test_nss_chromeos_user.h
- scoped_test_nss_db.cc
- scoped_test_nss_db.h
- scoped_test_system_nss_key_slot.cc
- scoped_test_system_nss_key_slot.h
- secure_hash.cc
- secure_hash.h
- secure_hash_unittest.cc
- secure_util.cc
- secure_util.h
- sha2.cc
- sha2.h
- sha2_unittest.cc
- sign.cc
- sign.h
- sign_unittest.cc
- signature_verifier.cc
- signature_verifier.h
- signature_verifier_unittest.cc
- subtle_passkey.cc
- subtle_passkey.h
- test_support.cc
- test_support.h
- unexportable_key.cc
- unexportable_key.h
- unexportable_key_mac.h
- unexportable_key_mac.mm
- unexportable_key_mac_unittest.mm
- unexportable_key_metrics.cc
- unexportable_key_metrics.h
- unexportable_key_metrics_unittest.cc
- unexportable_key_software_unsecure.cc
- unexportable_key_unittest.cc
- unexportable_key_win.cc
- unexportable_key_win.h
- user_verifying_key.cc
- user_verifying_key.h
- user_verifying_key_mac.mm
- user_verifying_key_mac_unittest.mm
- user_verifying_key_win.cc
README.md
//crypto README
This directory contains implementations of crypto primitives for use in Chromium. Most of these are either:
- Wrappers around platform-specific APIs (DPAPI, libsecret, etc), so that code elsewhere in Chromium can use cross-platform abstractions, or
- Wrappers around BoringSSL APIs that use Chromium-native types like base::span and similar
There is very little actual cryptographic code in //crypto - it is mostly wrappers.
This directory is actively being refactored as of 2025-06. See PLAN.md.
Commonly-Used Interfaces
Many interfaces in this directory are deprecated and being changed or removed; check the comment at the top of the header file before using them.
Advice For Clients
- Ciphertext, keys, certificates, and other cryptographic material are generally sequences of bytes, not characters, so prefer using byte-oriented types to represent them:
vector<uint8_t>
, array<uint8_t>
, and span<uint8_t>
rather than string
and string_view
. - To serialize private keys, use
keypair::PrivateKey::ToPrivateKeyInfo()
, which returns a PKCS#8 PrivateKeyInfo structure serialized as a byte vector. To unserialize keys in this format, use keypair::PrivateKey::FromPrivateKeyInfo()
. - To serialize public keys, use
keypair::PublicKey::ToSubjectPublicKeyInfo()
or keypair::PrivateKey::ToSubjectPublicKeyInfo()
, which return a X.509 SubjectPublicKeyInfo structure serialized as a byte vector. To unserialize public keys in this format, use keypair::PublicKey::FromPublicKeyInfo()
. - SubjectPublicKeyInfo and PrivateKeyInfo can represent many kinds of keys, so code that expects a specific kind of key must check the kind after deserialization.
- To serialize symmetric keys (AEAD, HMAC, or symmetric encryption keys), use a raw sequence of bytes for the key material. Represent these keys in memory using
vector<uint8_t>
, array<uint8_t>
, or span<uint8_t>
directly.