@@ -6,18 +6,7 @@ use parsec_client::core::interface::operations::psa_key_attributes::*;
66use parsec_client:: core:: interface:: requests:: ResponseStatus ;
77use parsec_client:: core:: interface:: requests:: Result ;
88use picky_asn1:: wrapper:: IntegerAsn1 ;
9- use serde:: { Deserialize , Serialize } ;
10-
11- // The RSA Public Key data are DER encoded with the following representation:
12- // RSAPublicKey ::= SEQUENCE {
13- // modulus INTEGER, -- n
14- // publicExponent INTEGER -- e
15- // }
16- #[ derive( Serialize , Deserialize , Debug ) ]
17- struct RsaPublicKey {
18- modulus : IntegerAsn1 ,
19- public_exponent : IntegerAsn1 ,
20- }
9+ use picky_asn1_x509:: RSAPublicKey ;
2110
2211const KEY_DATA : [ u8 ; 140 ] = [
2312 48 , 129 , 137 , 2 , 129 , 129 , 0 , 153 , 165 , 220 , 135 , 89 , 101 , 254 , 229 , 28 , 33 , 138 , 247 , 20 , 102 ,
@@ -83,7 +72,7 @@ fn check_format_import1() -> Result<()> {
8372 let mut client = TestClient :: new ( ) ;
8473 let key_name = String :: from ( "check_format_import" ) ;
8574
86- let public_key = RsaPublicKey {
75+ let public_key = RSAPublicKey {
8776 modulus : IntegerAsn1 :: from_unsigned_bytes_be ( example_modulus_1024 ( ) ) ,
8877 public_exponent : IntegerAsn1 :: from_unsigned_bytes_be ( vec ! [ 0x01 , 0x00 , 0x01 ] ) ,
8978 } ;
@@ -100,7 +89,7 @@ fn check_format_import2() -> Result<()> {
10089 let mut client = TestClient :: new ( ) ;
10190 let key_name = String :: from ( "check_format_import2" ) ;
10291
103- let public_key = RsaPublicKey {
92+ let public_key = RSAPublicKey {
10493 modulus : IntegerAsn1 :: from_unsigned_bytes_be ( example_modulus_1024 ( ) ) ,
10594 public_exponent : IntegerAsn1 :: from_unsigned_bytes_be ( vec ! [ 0x01 , 0x00 , 0x01 ] ) ,
10695 } ;
@@ -146,7 +135,7 @@ fn check_format_import3() -> Result<()> {
146135 let mut client = TestClient :: new ( ) ;
147136 let key_name = String :: from ( "check_format_import3" ) ;
148137
149- let public_key = RsaPublicKey {
138+ let public_key = RSAPublicKey {
150139 modulus : IntegerAsn1 :: from_unsigned_bytes_be ( vec ! [ 0xDE ; 1024 ] ) ,
151140 public_exponent : IntegerAsn1 :: from_unsigned_bytes_be ( vec ! [ 0x01 , 0x00 , 0x01 ] ) ,
152141 } ;
@@ -194,7 +183,7 @@ fn failed_imported_key_should_be_removed() -> Result<()> {
194183 let mut client = TestClient :: new ( ) ;
195184 let key_name = String :: from ( "failed_imported_key_should_be_removed" ) ;
196185
197- let public_key = RsaPublicKey {
186+ let public_key = RSAPublicKey {
198187 modulus : IntegerAsn1 :: from_unsigned_bytes_be ( example_modulus_1024 ( ) ) ,
199188 public_exponent : IntegerAsn1 :: from_unsigned_bytes_be ( vec ! [ 0x01 , 0x00 , 0x01 ] ) ,
200189 } ;
0 commit comments