Add ec::EcKey::private_key_from_der_for_group

In the `ECPrivateKey` schema (RFC 5915 s3) the parameters field which
holds the NamedCurve is optional.

If an EC key was originally enclosed in a PKCS#8 (RFC 5208 s5)
wrapper, the curve may be identified in the wrapper (in the
`AlgorithmIdentifier.parameters` field) rather than in the
`ECPrivateKey`.

In this case, the existing `ec::EcKey::private_key_from_der()` method
(which corresponds to `d2i_ECPrivateKey()`) cannot determine the curve
and so cannot import such a key.

Add a new method that includes explicit specification of the curve to
cope with this situation, passing through to the (BoringSSL-specific)
`EC_KEY_parse_private_key` function.

Test: VtsAidlKeyMintTargetTest against in-development Rust KeyMint
Change-Id: I7f1b9be822a10917a39bbf438caa1ddaafdbf091
1 file changed
tree: ae644a3860e0c5431a702f4c411107a35e9de0b1
  1. openssl/
  2. openssl-macros/
  3. Android.bp
  4. Cargo.toml
  5. cargo2android.json
  6. LICENSE
  7. METADATA
  8. MODULE_LICENSE_APACHE2
  9. OWNERS
  10. README.md
  11. TEST_MAPPING
  12. THIRD_PARTY
README.md

rust-openssl

crates.io

OpenSSL bindings for the Rust programming language.

Documentation.

Release Support

The current supported release of openssl is 0.10 and openssl-sys is 0.9.

New major versions will be published at most once per year. After a new release, the previous major version will be partially supported with bug fixes for 3 months, after which support will be dropped entirely.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed under the terms of both the Apache License, Version 2.0 and the MIT license without any additional terms or conditions.