@@ -278,25 +278,32 @@ impl Display for EncryptionAlgorithm {
278278
279279#[ derive( Debug , Serialize , Deserialize , Clone ) ]
280280pub struct DecryptParameters {
281- pub decrypt_parameters_encryption : DecryptParametersEncryption ,
281+ pub decrypt_parameters_encryption : CryptographParamtersEncryption ,
282282 #[ serde( serialize_with = "ser_base64" , deserialize_with = "deser_base64" ) ]
283283 pub ciphertext : Vec < u8 > ,
284284}
285285
286286#[ derive( Debug , Serialize , Deserialize , Clone ) ]
287287#[ serde( untagged) ]
288- pub enum DecryptParametersEncryption {
289- Rsa ( RsaDecryptParameters ) ,
290- AesGcm ( AesGcmDecryptParameters ) ,
291- AesCbc ( AesCbcDecryptParameters ) ,
288+ pub enum CryptographParamtersEncryption {
289+ Rsa ( RsaEncryptionParameters ) ,
290+ AesGcm ( AesGcmEncryptionParameters ) ,
291+ AesCbc ( AesCbcEncryptionParameters ) ,
292292}
293293
294294#[ derive( Debug , Serialize , Deserialize , Clone ) ]
295- pub struct RsaDecryptParameters {
295+ pub struct EncryptParameters {
296+ pub encrypt_parameters_encryption : CryptographParamtersEncryption ,
297+ #[ serde( serialize_with = "ser_base64" , deserialize_with = "deser_base64" ) ]
298+ pub plaintext : Vec < u8 > ,
299+ }
300+
301+ #[ derive( Debug , Serialize , Deserialize , Clone ) ]
302+ pub struct RsaEncryptionParameters {
296303 pub algorithm : EncryptionAlgorithm ,
297304}
298305
299- impl RsaDecryptParameters {
306+ impl RsaEncryptionParameters {
300307 pub fn new ( algorithm : EncryptionAlgorithm ) -> Result < Self , Error > {
301308 match algorithm {
302309 EncryptionAlgorithm :: Rsa15
@@ -310,7 +317,7 @@ impl RsaDecryptParameters {
310317}
311318
312319#[ derive( Debug , Serialize , Deserialize , Clone ) ]
313- pub struct AesGcmDecryptParameters {
320+ pub struct AesGcmEncryptionParameters {
314321 pub algorithm : EncryptionAlgorithm ,
315322 #[ serde( serialize_with = "ser_base64" , deserialize_with = "deser_base64" ) ]
316323 pub iv : Vec < u8 > ,
@@ -323,7 +330,7 @@ pub struct AesGcmDecryptParameters {
323330 pub additional_authenticated_data : Option < Vec < u8 > > ,
324331}
325332
326- impl AesGcmDecryptParameters {
333+ impl AesGcmEncryptionParameters {
327334 pub fn new (
328335 algorithm : EncryptionAlgorithm ,
329336 iv : Vec < u8 > ,
@@ -347,13 +354,13 @@ impl AesGcmDecryptParameters {
347354}
348355
349356#[ derive( Debug , Serialize , Deserialize , Clone ) ]
350- pub struct AesCbcDecryptParameters {
357+ pub struct AesCbcEncryptionParameters {
351358 pub algorithm : EncryptionAlgorithm ,
352359 #[ serde( serialize_with = "ser_base64" , deserialize_with = "deser_base64" ) ]
353360 pub iv : Vec < u8 > ,
354361}
355362
356- impl AesCbcDecryptParameters {
363+ impl AesCbcEncryptionParameters {
357364 pub fn new ( algorithm : EncryptionAlgorithm , iv : Vec < u8 > ) -> Result < Self , Error > {
358365 match algorithm {
359366 EncryptionAlgorithm :: A128Cbc
@@ -382,3 +389,17 @@ pub struct DecryptResult {
382389 ) ]
383390 pub result : Vec < u8 > ,
384391}
392+
393+ #[ derive( Debug , Deserialize ) ]
394+ pub struct EncryptResult {
395+ #[ serde( skip) ]
396+ pub algorithm : EncryptionAlgorithm ,
397+ #[ serde( rename = "kid" ) ]
398+ pub key_id : String ,
399+ #[ serde(
400+ rename = "value" ,
401+ serialize_with = "ser_base64" ,
402+ deserialize_with = "deser_base64"
403+ ) ]
404+ pub result : Vec < u8 > ,
405+ }
0 commit comments