File tree 1 file changed +3
-10
lines changed 1 file changed +3
-10
lines changed Original file line number Diff line number Diff line change @@ -200,26 +200,19 @@ impl FileEncryptor {
200
200
}
201
201
}
202
202
203
- /// Encrypt a Thrift serializable object
203
+ /// Write an encrypted Thrift serializable object
204
204
pub ( crate ) fn encrypt_object < T : TSerializable , W : Write > (
205
205
object : & T ,
206
206
encryptor : & mut Box < dyn BlockEncryptor > ,
207
207
sink : & mut W ,
208
208
module_aad : & [ u8 ] ,
209
209
) -> Result < ( ) > {
210
- let mut buffer: Vec < u8 > = vec ! [ ] ;
211
- {
212
- let mut unencrypted_protocol = TCompactOutputProtocol :: new ( & mut buffer) ;
213
- object. write_to_out_protocol ( & mut unencrypted_protocol) ?;
214
- }
215
-
216
- let encrypted_buffer = encryptor. encrypt ( buffer. as_ref ( ) , module_aad) ?;
217
-
210
+ let encrypted_buffer = encrypt_object_to_vec ( object, encryptor, module_aad) ?;
218
211
sink. write_all ( & encrypted_buffer) ?;
219
212
Ok ( ( ) )
220
213
}
221
214
222
- /// Encrypt a Thrift serializable object
215
+ /// Encrypt a Thrift serializable object to a byte vector
223
216
pub ( crate ) fn encrypt_object_to_vec < T : TSerializable > (
224
217
object : & T ,
225
218
encryptor : & mut Box < dyn BlockEncryptor > ,
You can’t perform that action at this time.
0 commit comments