@@ -173,7 +173,7 @@ use zeroize::Zeroizing;
173
173
///};
174
174
///
175
175
///client
176
- /// .psa_generate_key(key_name.clone() , key_attrs)
176
+ /// .psa_generate_key(& key_name, key_attrs)
177
177
/// .expect("Failed to create key!");
178
178
///```
179
179
#[ derive( Debug ) ]
@@ -469,11 +469,11 @@ impl BasicClient {
469
469
///
470
470
/// See the operation-specific response codes returned by the service
471
471
/// [here](https://parallaxsecond.github.io/parsec-book/parsec_client/operations/psa_generate_key.html#specific-response-status-codes).
472
- pub fn psa_generate_key ( & self , key_name : String , key_attributes : Attributes ) -> Result < ( ) > {
472
+ pub fn psa_generate_key ( & self , key_name : & str , key_attributes : Attributes ) -> Result < ( ) > {
473
473
let crypto_provider = self . can_provide_crypto ( ) ?;
474
474
475
475
let op = PsaGenerateKey {
476
- key_name,
476
+ key_name : String :: from ( key_name ) ,
477
477
attributes : key_attributes,
478
478
} ;
479
479
@@ -499,10 +499,12 @@ impl BasicClient {
499
499
///
500
500
/// See the operation-specific response codes returned by the service
501
501
/// [here](https://parallaxsecond.github.io/parsec-book/parsec_client/operations/psa_destroy_key.html#specific-response-status-codes).
502
- pub fn psa_destroy_key ( & self , key_name : String ) -> Result < ( ) > {
502
+ pub fn psa_destroy_key ( & self , key_name : & str ) -> Result < ( ) > {
503
503
let crypto_provider = self . can_provide_crypto ( ) ?;
504
504
505
- let op = PsaDestroyKey { key_name } ;
505
+ let op = PsaDestroyKey {
506
+ key_name : String :: from ( key_name) ,
507
+ } ;
506
508
507
509
let _ = self . op_client . process_operation (
508
510
NativeOperation :: PsaDestroyKey ( op) ,
@@ -541,15 +543,15 @@ impl BasicClient {
541
543
/// [here](https://parallaxsecond.github.io/parsec-book/parsec_client/operations/psa_import_key.html#specific-response-status-codes).
542
544
pub fn psa_import_key (
543
545
& self ,
544
- key_name : String ,
546
+ key_name : & str ,
545
547
key_material : & [ u8 ] ,
546
548
key_attributes : Attributes ,
547
549
) -> Result < ( ) > {
548
550
let key_material = Secret :: new ( key_material. to_vec ( ) ) ;
549
551
let crypto_provider = self . can_provide_crypto ( ) ?;
550
552
551
553
let op = PsaImportKey {
552
- key_name,
554
+ key_name : String :: from ( key_name ) ,
553
555
attributes : key_attributes,
554
556
data : key_material,
555
557
} ;
@@ -577,10 +579,12 @@ impl BasicClient {
577
579
///
578
580
/// See the operation-specific response codes returned by the service
579
581
/// [here](https://parallaxsecond.github.io/parsec-book/parsec_client/operations/psa_export_public_key.html#specific-response-status-codes).
580
- pub fn psa_export_public_key ( & self , key_name : String ) -> Result < Vec < u8 > > {
582
+ pub fn psa_export_public_key ( & self , key_name : & str ) -> Result < Vec < u8 > > {
581
583
let crypto_provider = self . can_provide_crypto ( ) ?;
582
584
583
- let op = PsaExportPublicKey { key_name } ;
585
+ let op = PsaExportPublicKey {
586
+ key_name : String :: from ( key_name) ,
587
+ } ;
584
588
585
589
let res = self . op_client . process_operation (
586
590
NativeOperation :: PsaExportPublicKey ( op) ,
@@ -611,10 +615,12 @@ impl BasicClient {
611
615
///
612
616
/// See the operation-specific response codes returned by the service
613
617
/// [here](https://parallaxsecond.github.io/parsec-book/parsec_client/operations/psa_export_key.html#specific-response-status-codes).
614
- pub fn psa_export_key ( & self , key_name : String ) -> Result < Vec < u8 > > {
618
+ pub fn psa_export_key ( & self , key_name : & str ) -> Result < Vec < u8 > > {
615
619
let crypto_provider = self . can_provide_crypto ( ) ?;
616
620
617
- let op = PsaExportKey { key_name } ;
621
+ let op = PsaExportKey {
622
+ key_name : String :: from ( key_name) ,
623
+ } ;
618
624
619
625
let res = self . op_client . process_operation (
620
626
NativeOperation :: PsaExportKey ( op) ,
@@ -652,15 +658,15 @@ impl BasicClient {
652
658
/// [here](https://parallaxsecond.github.io/parsec-book/parsec_client/operations/psa_sign_hash.html#specific-response-status-codes).
653
659
pub fn psa_sign_hash (
654
660
& self ,
655
- key_name : String ,
661
+ key_name : & str ,
656
662
hash : & [ u8 ] ,
657
663
sign_algorithm : AsymmetricSignature ,
658
664
) -> Result < Vec < u8 > > {
659
665
let hash = Zeroizing :: new ( hash. to_vec ( ) ) ;
660
666
let crypto_provider = self . can_provide_crypto ( ) ?;
661
667
662
668
let op = PsaSignHash {
663
- key_name,
669
+ key_name : String :: from ( key_name ) ,
664
670
alg : sign_algorithm,
665
671
hash,
666
672
} ;
@@ -701,7 +707,7 @@ impl BasicClient {
701
707
/// [here](https://parallaxsecond.github.io/parsec-book/parsec_client/operations/psa_verify_hash.html#specific-response-status-codes).
702
708
pub fn psa_verify_hash (
703
709
& self ,
704
- key_name : String ,
710
+ key_name : & str ,
705
711
hash : & [ u8 ] ,
706
712
sign_algorithm : AsymmetricSignature ,
707
713
signature : & [ u8 ] ,
@@ -711,7 +717,7 @@ impl BasicClient {
711
717
let crypto_provider = self . can_provide_crypto ( ) ?;
712
718
713
719
let op = PsaVerifyHash {
714
- key_name,
720
+ key_name : String :: from ( key_name ) ,
715
721
alg : sign_algorithm,
716
722
hash,
717
723
signature,
@@ -744,15 +750,15 @@ impl BasicClient {
744
750
/// [here](https://parallaxsecond.github.io/parsec-book/parsec_client/operations/psa_sign_message.html#specific-response-status-codes).
745
751
pub fn psa_sign_message (
746
752
& self ,
747
- key_name : String ,
753
+ key_name : & str ,
748
754
msg : & [ u8 ] ,
749
755
sign_algorithm : AsymmetricSignature ,
750
756
) -> Result < Vec < u8 > > {
751
757
let message = Zeroizing :: new ( msg. to_vec ( ) ) ;
752
758
let crypto_provider = self . can_provide_crypto ( ) ?;
753
759
754
760
let op = PsaSignMessage {
755
- key_name,
761
+ key_name : String :: from ( key_name ) ,
756
762
alg : sign_algorithm,
757
763
message,
758
764
} ;
@@ -790,7 +796,7 @@ impl BasicClient {
790
796
/// [here](https://parallaxsecond.github.io/parsec-book/parsec_client/operations/psa_verify_message.html#specific-response-status-codes).
791
797
pub fn psa_verify_message (
792
798
& self ,
793
- key_name : String ,
799
+ key_name : & str ,
794
800
msg : & [ u8 ] ,
795
801
sign_algorithm : AsymmetricSignature ,
796
802
signature : & [ u8 ] ,
@@ -800,7 +806,7 @@ impl BasicClient {
800
806
let crypto_provider = self . can_provide_crypto ( ) ?;
801
807
802
808
let op = PsaVerifyMessage {
803
- key_name,
809
+ key_name : String :: from ( key_name ) ,
804
810
alg : sign_algorithm,
805
811
message,
806
812
signature,
@@ -836,7 +842,7 @@ impl BasicClient {
836
842
/// [here](https://parallaxsecond.github.io/parsec-book/parsec_client/operations/psa_asymmetric_encrypt.html#specific-response-status-codes).
837
843
pub fn psa_asymmetric_encrypt (
838
844
& self ,
839
- key_name : String ,
845
+ key_name : & str ,
840
846
encrypt_alg : AsymmetricEncryption ,
841
847
plaintext : & [ u8 ] ,
842
848
salt : Option < & [ u8 ] > ,
@@ -845,7 +851,7 @@ impl BasicClient {
845
851
let crypto_provider = self . can_provide_crypto ( ) ?;
846
852
847
853
let op = PsaAsymEncrypt {
848
- key_name,
854
+ key_name : String :: from ( key_name ) ,
849
855
alg : encrypt_alg,
850
856
plaintext : plaintext. to_vec ( ) . into ( ) ,
851
857
salt,
@@ -888,7 +894,7 @@ impl BasicClient {
888
894
/// [here](https://parallaxsecond.github.io/parsec-book/parsec_client/operations/psa_asymmetric_decrypt.html#specific-response-status-codes).
889
895
pub fn psa_asymmetric_decrypt (
890
896
& self ,
891
- key_name : String ,
897
+ key_name : & str ,
892
898
encrypt_alg : AsymmetricEncryption ,
893
899
ciphertext : & [ u8 ] ,
894
900
salt : Option < & [ u8 ] > ,
@@ -897,7 +903,7 @@ impl BasicClient {
897
903
let crypto_provider = self . can_provide_crypto ( ) ?;
898
904
899
905
let op = PsaAsymDecrypt {
900
- key_name,
906
+ key_name : String :: from ( key_name ) ,
901
907
alg : encrypt_alg,
902
908
ciphertext : Zeroizing :: new ( ciphertext. to_vec ( ) ) ,
903
909
salt,
@@ -998,7 +1004,7 @@ impl BasicClient {
998
1004
/// [here](https://parallaxsecond.github.io/parsec-book/parsec_client/operations/psa_aead_encrypt.html#specific-response-status-codes).
999
1005
pub fn psa_aead_encrypt (
1000
1006
& self ,
1001
- key_name : String ,
1007
+ key_name : & str ,
1002
1008
encrypt_alg : Aead ,
1003
1009
nonce : & [ u8 ] ,
1004
1010
additional_data : & [ u8 ] ,
@@ -1007,7 +1013,7 @@ impl BasicClient {
1007
1013
let crypto_provider = self . can_provide_crypto ( ) ?;
1008
1014
1009
1015
let op = PsaAeadEncrypt {
1010
- key_name,
1016
+ key_name : String :: from ( key_name ) ,
1011
1017
alg : encrypt_alg,
1012
1018
nonce : nonce. to_vec ( ) . into ( ) ,
1013
1019
additional_data : additional_data. to_vec ( ) . into ( ) ,
@@ -1051,7 +1057,7 @@ impl BasicClient {
1051
1057
/// [here](https://parallaxsecond.github.io/parsec-book/parsec_client/operations/psa_aead_decrypt.html#specific-response-status-codes).
1052
1058
pub fn psa_aead_decrypt (
1053
1059
& self ,
1054
- key_name : String ,
1060
+ key_name : & str ,
1055
1061
encrypt_alg : Aead ,
1056
1062
nonce : & [ u8 ] ,
1057
1063
additional_data : & [ u8 ] ,
@@ -1060,7 +1066,7 @@ impl BasicClient {
1060
1066
let crypto_provider = self . can_provide_crypto ( ) ?;
1061
1067
1062
1068
let op = PsaAeadDecrypt {
1063
- key_name,
1069
+ key_name : String :: from ( key_name ) ,
1064
1070
alg : encrypt_alg,
1065
1071
nonce : nonce. to_vec ( ) . into ( ) ,
1066
1072
additional_data : additional_data. to_vec ( ) . into ( ) ,
@@ -1103,12 +1109,12 @@ impl BasicClient {
1103
1109
pub fn psa_raw_key_agreement (
1104
1110
& self ,
1105
1111
alg : RawKeyAgreement ,
1106
- private_key_name : String ,
1112
+ private_key_name : & str ,
1107
1113
peer_key : & [ u8 ] ,
1108
1114
) -> Result < Vec < u8 > > {
1109
1115
let op = PsaRawKeyAgreement {
1110
1116
alg,
1111
- private_key_name,
1117
+ private_key_name : String :: from ( private_key_name ) ,
1112
1118
peer_key : Zeroizing :: new ( peer_key. to_vec ( ) ) ,
1113
1119
} ;
1114
1120
let crypto_provider = self . can_provide_crypto ( ) ?;
0 commit comments