2
0
mirror of https://github.com/openkmip/pykmip synced 2025-12-18 01:03:49 +00:00

Add operation policy name to demo scripts

This change adds the ability to set the operation policy name
attribute to object creation demo scripts, including demos for
the Create, CreateKeyPair, and Register operations.
This commit is contained in:
Peter Hamilton
2018-04-02 10:39:58 -04:00
parent 6bda8ec999
commit a75f0e3666
12 changed files with 74 additions and 2 deletions

View File

@@ -13,6 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from kmip.core import enums
from kmip.core.enums import AttributeType
from kmip.core.enums import CredentialType
from kmip.core.enums import CryptographicAlgorithm
@@ -108,6 +109,14 @@ if __name__ == '__main__':
name = Attribute(attribute_name=name, attribute_value=value)
attributes = [algorithm_obj, usage_mask, length_obj, name]
if opts.operation_policy_name is not None:
opn = attribute_factory.create_attribute(
enums.AttributeType.OPERATION_POLICY_NAME,
opts.operation_policy_name
)
attributes.append(opn)
template_attribute = TemplateAttribute(attributes=attributes)
# Create the SYMMETRIC_KEY object