1diff --git a/src/ec.rs b/src/ec.rs 2index a6a6dc9..88dcaaf 100644 3--- a/src/ec.rs 4+++ b/src/ec.rs 5@@ -908,6 +908,26 @@ impl EcKey<Private> { 6 EcKey<Private>, 7 ffi::d2i_ECPrivateKey 8 } 9+ 10+ /// Decodes a DER-encoded elliptic curve private key structure for the specified curve. 11+ #[corresponds(EC_KEY_parse_private_key)] 12+ #[cfg(boringssl)] 13+ pub fn private_key_from_der_for_group( 14+ der: &[u8], 15+ group: &EcGroupRef, 16+ ) -> Result<EcKey<Private>, ErrorStack> { 17+ unsafe { 18+ let mut cbs = ffi::CBS { 19+ data: der.as_ptr(), 20+ len: der.len(), 21+ }; 22+ cvt_p(ffi::EC_KEY_parse_private_key( 23+ &mut cbs as *mut ffi::CBS, 24+ group.as_ptr(), 25+ )) 26+ .map(|p| EcKey::from_ptr(p)) 27+ } 28+ } 29 } 30 31 impl<T> Clone for EcKey<T> { 32