From f9688c44319c1733586d6fbc3b3c24a403deaed8 Mon Sep 17 00:00:00 2001 From: Hugues de Valon Date: Fri, 30 Apr 2021 10:48:37 +0100 Subject: [PATCH] Make it compile for Rust 1.43.1 The From trait was not implemented for that version of Rust. Uses the to_vec method which achieves the same thing. Signed-off-by: Hugues de Valon --- src/providers/pkcs11/key_management.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/providers/pkcs11/key_management.rs b/src/providers/pkcs11/key_management.rs index 6bc5e06..73ce607 100644 --- a/src/providers/pkcs11/key_management.rs +++ b/src/providers/pkcs11/key_management.rs @@ -27,7 +27,7 @@ impl Provider { key_id: u32, key_type: KeyPairType, ) -> Result { - let mut template = vec![Attribute::Id(key_id.to_be_bytes().into())]; + let mut template = vec![Attribute::Id(key_id.to_be_bytes().to_vec())]; match key_type { KeyPairType::PublicKey => template.push(Attribute::Class(ObjectClass::PUBLIC_KEY)), @@ -103,7 +103,7 @@ impl Provider { let key_id = self.create_key_id(); let mut pub_template = vec![ - Attribute::Id(key_id.to_be_bytes().into()), + Attribute::Id(key_id.to_be_bytes().to_vec()), Attribute::Token(true.into()), Attribute::AllowedMechanisms(vec![Mechanism::try_from( key_attributes.policy.permitted_algorithms, @@ -122,7 +122,7 @@ impl Provider { let mech = match key_attributes.key_type { Type::RsaKeyPair => { pub_template.push(Attribute::Private(false.into())); - pub_template.push(Attribute::PublicExponent(utils::PUBLIC_EXPONENT.into())); + pub_template.push(Attribute::PublicExponent(utils::PUBLIC_EXPONENT.to_vec())); pub_template.push(Attribute::ModulusBits( key_attributes.bits.try_into().map_err(to_response_status)?, )); @@ -225,7 +225,7 @@ impl Provider { template.push(Attribute::PublicExponent(exponent_object.into())); template.push(Attribute::Verify(true.into())); template.push(Attribute::Encrypt(true.into())); - template.push(Attribute::Id(key_id.to_be_bytes().into())); + template.push(Attribute::Id(key_id.to_be_bytes().to_vec())); template.push(Attribute::Private(false.into())); template.push(Attribute::AllowedMechanisms(vec![MechanismType::RSA_PKCS]));