@@ -519,7 +519,7 @@ impl<Ids: KeyIds> KeyStoreContext<'_, Ids> {
519
519
/// Re-encrypts the user's keys with the provided symmetric key for a v2 user.
520
520
pub fn dangerous_get_v2_rotated_account_keys (
521
521
& self ,
522
- new_user_key : SymmetricCryptoKey ,
522
+ new_user_key : & SymmetricCryptoKey ,
523
523
current_user_private_key_id : Ids :: Asymmetric ,
524
524
current_user_signing_key_id : Ids :: Signing ,
525
525
) -> Result < RotatedUserKeys > {
@@ -544,7 +544,7 @@ mod tests {
544
544
} ,
545
545
traits:: tests:: { TestAsymmKey , TestIds , TestSigningKey , TestSymmKey } ,
546
546
AsymmetricCryptoKey , AsymmetricPublicCryptoKey , CompositeEncryptable , CoseKeyBytes ,
547
- CoseSerializable , Decryptable , KeyDecryptable , Pkcs8PrivateKeyBytes ,
547
+ CoseSerializable , CryptoError , Decryptable , KeyDecryptable , Pkcs8PrivateKeyBytes ,
548
548
PublicKeyEncryptionAlgorithm , SignatureAlgorithm , SignedPublicKey , SigningKey ,
549
549
SigningNamespace , SpkiPublicKeyBytes , SymmetricCryptoKey ,
550
550
} ;
@@ -759,23 +759,23 @@ mod tests {
759
759
// Get the rotated account keys
760
760
let rotated_keys = ctx
761
761
. dangerous_get_v2_rotated_account_keys (
762
- new_user_key,
762
+ & new_user_key,
763
763
current_user_private_key_id,
764
764
current_user_signing_key_id,
765
765
)
766
766
. unwrap ( ) ;
767
767
768
- let user_key = ctx. get_symmetric_key ( TestSymmKey :: A ( 0 ) ) . unwrap ( ) ;
769
-
770
768
// Public/Private key
771
769
assert_eq ! (
772
770
AsymmetricPublicCryptoKey :: from_der( & rotated_keys. public_key) . unwrap( ) ,
773
771
ctx. get_asymmetric_key( current_user_private_key_id)
774
772
. unwrap( )
775
773
. to_public_key( ) ,
776
774
) ;
777
- let decrypted_private_key: Vec < u8 > =
778
- rotated_keys. private_key . decrypt_with_key ( user_key) . unwrap ( ) ;
775
+ let decrypted_private_key: Vec < u8 > = rotated_keys
776
+ . private_key
777
+ . decrypt_with_key ( & new_user_key)
778
+ . unwrap ( ) ;
779
779
let private_key =
780
780
AsymmetricCryptoKey :: from_der ( & Pkcs8PrivateKeyBytes :: from ( decrypted_private_key) )
781
781
. unwrap ( ) ;
@@ -788,8 +788,10 @@ mod tests {
788
788
) ;
789
789
790
790
// Signing Key
791
- let decrypted_signing_key: Vec < u8 > =
792
- rotated_keys. signing_key . decrypt_with_key ( user_key) . unwrap ( ) ;
791
+ let decrypted_signing_key: Vec < u8 > = rotated_keys
792
+ . signing_key
793
+ . decrypt_with_key ( & new_user_key)
794
+ . unwrap ( ) ;
793
795
let signing_key =
794
796
SigningKey :: from_cose ( & CoseKeyBytes :: from ( decrypted_signing_key) ) . unwrap ( ) ;
795
797
assert_eq ! (
0 commit comments