File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
tss-esapi/src/structures/tagged Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,8 @@ use log::error;
2121use std:: convert:: { TryFrom , TryInto } ;
2222use tss_esapi_sys:: { TPMU_PUBLIC_ID , TPMU_PUBLIC_PARMS } ;
2323
24+ use super :: symmetric:: SymmetricDefinitionObject ;
25+
2426/// A builder for the [Public] type.
2527#[ derive( Debug , Clone ) ]
2628pub struct PublicBuilder {
@@ -374,6 +376,16 @@ impl Public {
374376 }
375377 }
376378
379+ /// Returns the name hashing algorithm
380+ pub fn symmetric_algorithm ( & self ) -> Result < SymmetricDefinitionObject > {
381+ match self {
382+ Public :: Rsa { parameters, .. } => Ok ( parameters. symmetric_definition_object ( ) ) ,
383+ Public :: KeyedHash { .. } => Err ( Error :: local_error ( WrapperErrorKind :: InvalidParam ) ) ,
384+ Public :: Ecc { parameters, .. } => Ok ( parameters. symmetric_definition_object ( ) ) ,
385+ Public :: SymCipher { parameters, .. } => Ok ( parameters. symmetric_definition_object ( ) ) ,
386+ }
387+ }
388+
377389 /// Returns the auth policy digest.
378390 pub fn auth_policy ( & self ) -> & Digest {
379391 match self {
You can’t perform that action at this time.
0 commit comments