@@ -59,6 +59,9 @@ def generate_options(self, group_parser):
5959 '--hierarchy-auth' ,
6060 help = 'The hierarchyauth, required for transient pobjects.\n ' ,
6161 default = '' )
62+ group_parser .add_argument (
63+ '--policy' ,
64+ help = 'Policy to apply on using the key (in JSON format).\n ' )
6265 pinopts = group_parser .add_mutually_exclusive_group ()
6366 pinopts .add_argument ('--sopin' , help = 'The Administrator pin.\n ' ),
6467 pinopts .add_argument ('--userpin' , help = 'The User pin.\n ' ),
@@ -174,6 +177,7 @@ def __call__(self, args):
174177 key_label = args ['key_label' ]
175178 tid = args ['id' ]
176179 hierarchyauth = args ['hierarchy_auth' ]
180+ policy = args ['policy' ]
177181 passin = args ['passin' ] if 'passin' in args else None
178182
179183 privkey = None
@@ -206,6 +210,9 @@ def __call__(self, args):
206210 # handle options that can add additional attributes
207211 always_auth = args ['attr_always_authenticate' ]
208212 priv_attrs = {CKA_ALWAYS_AUTHENTICATE : always_auth }
213+ if policy is not None :
214+ validate_policy (policy )
215+ priv_attrs [CKA_TPM2_POLICY_JSON ] = policy
209216
210217 override_keylen = getattr (self , '_override_keylen' , None )
211218
0 commit comments