Lines Matching refs:EcKey

133     /// use openssl::ec::{EcGroup, EcKey};
137 /// let key = EcKey::generate(&group)?;
690 pub struct EcKey<T>;
691 /// A reference to an [`EcKey`].
781 type Owned = EcKey<T>;
783 fn to_owned(&self) -> EcKey<T> {
787 EcKey::from_ptr(self.as_ptr())
792 impl EcKey<Params> {
793 /// Constructs an `EcKey` corresponding to a known curve.
798 pub fn from_curve_name(nid: Nid) -> Result<EcKey<Params>, ErrorStack> {
801 cvt_p(ffi::EC_KEY_new_by_curve_name(nid.as_raw())).map(|p| EcKey::from_ptr(p))
805 /// Constructs an `EcKey` corresponding to a curve.
807 pub fn from_group(group: &EcGroupRef) -> Result<EcKey<Params>, ErrorStack> {
810 .map(|p| EcKey::from_ptr(p))
818 impl EcKey<Public> {
819 /// Constructs an `EcKey` from the specified group with the associated [`EcPoint`]: `public_key`.
837 /// # EcKey::generate(&group)?.public_key().to_bytes(&group,
840 /// // create an EcKey from the binary form of a EcPoint
842 /// let key = EcKey::from_public_key(&group, &point)?;
850 ) -> Result<EcKey<Public>, ErrorStack> {
853 .map(|p| EcKey::from_ptr(p))
873 ) -> Result<EcKey<Public>, ErrorStack> {
876 .map(|p| EcKey::from_ptr(p))
897 EcKey<Public>,
905 EcKey<Public>,
910 impl EcKey<Private> {
919 /// use openssl::ec::{EcGroup, EcKey, PointConversionForm};
923 /// let key = EcKey::generate(&group)?;
940 pub fn generate(group: &EcGroupRef) -> Result<EcKey<Private>, ErrorStack> {
943 .map(|p| EcKey::from_ptr(p))
957 ) -> Result<EcKey<Private>, ErrorStack> {
960 .map(|p| EcKey::from_ptr(p))
1001 EcKey<Private>,
1009 EcKey<Private>,
1014 impl<T> Clone for EcKey<T> {
1015 fn clone(&self) -> EcKey<T> {
1020 impl<T> fmt::Debug for EcKey<T> {
1022 write!(f, "EcKey")
1036 EcKey::from_curve_name(Nid::X9_62_PRIME256V1).unwrap();
1042 EcKey::generate(&group).unwrap();
1150 let key = EcKey::generate(&group).unwrap();
1163 let key = EcKey::generate(&group).unwrap();
1177 let key = EcKey::generate(&group).unwrap();
1190 let key = EcKey::generate(&group).unwrap();
1200 let key = EcKey::generate(&group).unwrap();
1223 let key = EcKey::generate(&group).unwrap();
1232 let ec_key = EcKey::from_public_key(&group, &public_key).unwrap();
1239 let key = EcKey::generate(&group).unwrap();
1242 EcKey::from_private_components(&group, key.private_key(), key.public_key()).unwrap();
1259 let ec_key = EcKey::from_public_key_affine_coordinates(&group, &xbn, &ybn).unwrap();
1275 let ec_key = EcKey::from_public_key_affine_coordinates(&group, &xbn, &ybn).unwrap();
1299 let ec_key = EcKey::from_public_key_affine_coordinates(&group, &xbn, &ybn).unwrap();