Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions openssl/src/ec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1009,6 +1009,29 @@ impl EcKey<Private> {
EcKey<Private>,
ffi::d2i_ECPrivateKey
}

/// Decodes a DER-encoded elliptic curve private key structure for the specified curve.
#[corresponds(EC_KEY_parse_private_key)]
#[cfg(boringssl)]
pub fn private_key_from_der_for_group(
der: &[u8],
group: &EcGroupRef,
) -> Result<EcKey<Private>, ErrorStack> {
unsafe {
let mut cbs = ffi::CBS {
data: der.as_ptr(),
len: der.len(),
};
let p = cvt_p(ffi::EC_KEY_parse_private_key(
&mut cbs as *mut ffi::CBS,
group.as_ptr(),
))?;
if ffi::CBS_len(p) != 0 {
todo!()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can one of the maintainers let me know what you'd suggest I do here to generate a new error? Thanks!

}
Ok(EcKey::from_ptr(p))
}
}
}

impl<T> Clone for EcKey<T> {
Expand Down
Loading