]> git.proxmox.com Git - proxmox-acme-rs.git/commitdiff
replace deprecated 'affine_coordinates_gfp' call
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 17 Aug 2022 06:58:44 +0000 (08:58 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 17 Aug 2022 07:03:27 +0000 (09:03 +0200)
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
src/key.rs

index 487f65ecc1158493e1fda259e89a85f81b6d4706..5dbc5460d43f5437758596ec4dc0264c139635fb 100644 (file)
@@ -106,9 +106,8 @@ impl<P: HasPublic> TryFrom<&openssl::ec::EcKey<P>> for EcPublicKey {
         let mut ctx = openssl::bn::BigNumContext::new()?;
         let mut x = openssl::bn::BigNum::new()?;
         let mut y = openssl::bn::BigNum::new()?;
-        let _: () = key
-            .public_key()
-            .affine_coordinates_gfp(group, &mut x, &mut y, &mut ctx)?;
+        key.public_key()
+            .affine_coordinates(group, &mut x, &mut y, &mut ctx)?;
 
         Ok(EcPublicKey {
             crv: "P-256",
@@ -117,3 +116,14 @@ impl<P: HasPublic> TryFrom<&openssl::ec::EcKey<P>> for EcPublicKey {
         })
     }
 }
+
+#[test]
+fn test_key_conversion() -> Result<(), Error> {
+    let key = openssl::ec::EcKey::generate(
+        openssl::ec::EcGroup::from_curve_name(openssl::nid::Nid::X9_62_PRIME256V1)?.as_ref(),
+    )?;
+
+    let _ = EcPublicKey::try_from(&key).expect("failed to jsonify ec key");
+
+    Ok(())
+}