批处理命令

批处理命令提供对 PKCS #11 工具的命令行访问。

在 PKCS #11 密钥管理工具(p11km)中,下列批处理命令可用。

注: 要使用批处理命令,请执行以下操作:
  1. 创建和编辑批处理文件,如 批处理中所述。
  2. 创建新的 p11km_cmd 部分,它们包含要使用的批处理命令的属性。
列示可用的 PKCS #11 令牌
生成报告并显示可用 PKCS #11 令牌的令牌和插槽信息。
必需属性
action_name = “LIST_TOKENS”
可选属性
start_gui = “<boolean>”

Where <布尔> is eitherTRUE or FALSE

示例
[p11km_cmd_list_tokens]
action_name = “LIST_TOKENS”
列示可用的 PKCS#11 机制
生成报告并显示受特定 PKCS #11 令牌(通过指定驱动程序和插槽属性值来匹配)支持的可用 PKCS #11 机制。
必需属性
action_name = “LIST_MECHANISMS”
p11_driver = “<driver name>”
p11_slot = “<slot number>”
Where <插槽号> is a positive integer value, and <驱动程序名称> is one of the following values:
描述
AIX® AIX 操作系统加密框架
IBM_4758_4960 IBM® 4758/4960 加密硬件适配器
IBM_4764 IBM 4764 加密硬件适配器
其他 如果指定 OTHER,那么还必须指定 p11_driver_path 属性。
可选属性
start_gui = “<boolean>”
补充属性
p11_driver_path = “<path to PKCS#11 driver>”

Where <PKCS#11 驱动程序的路径> is the full UNIX path and filename of the PKCS #11 library that is used for the command. 仅当 p11_driver 属性设置为 OTHER 时,可以指定此属性。

示例
[p11km_cmd_list_4764_slot_0_mechs]
action_name = “LIST_MECHANISMS”
p11_driver = “IBM_4764”
p11_slot = “0”
start_gui = “TRUE”
列示可用的 PKCS #11 对象
生成报告并显示受 PKCS #11 令牌(通过指定驱动程序和插槽属性值来匹配)支持的可用 PKCS #11 对象。
必需属性
action_name = “LIST_OBJECTS”
p11_driver = “<driver name>”
p11_slot = “<slot number>”
可选属性
p11_login = “<boolean>”
p11_label = “<string>”
p11_class = “<PKCS#11 Object Class>”
p11_private = “<boolean>”
p11_trusted = “<boolean>”
p11_sensitive = “<boolean>”
start_gui = “<boolean>”
Where <PKCS#11 对象类> is one of the following values as defined in the PKCS #11 specification from RSA:
CKO_DATA
CKO_CERTIFICATE
CKO_PUBLIC_KEY
CKO_PRIVATE_KEY
CKO_SECRET_KEY
CKO_HW_FEATURE
CKO_DOMAIN_PARAMETERS
CKO_MECHANISM
CKO_VENDOR_DEFINED
示例
[p11km_cmd_list_private_objs]
action_name = “LIST_OBJECTS”
p11_login = “TRUE”
p11_private = “TRUE”
p11_driver = “AIX”
p11_slot = “5”
更改 PKCS #11 令牌用户的 PIN:
更改登录到令牌时使用的 PKCS #11 令牌用户的 PIN。
必需属性
action_name = “CHANGE_USER_PIN”
p11_driver = “<driver name>”
p11_slot = “<slot number>”
可选属性
start_gui = “<boolean>”
示例
[p11km_cmd_change_my_pin]
action_name = “CHANGE_USER_PIN”
p11_slot = “1337”
p11_driver = “IBM_4764”
删除 PKCS #11 对象
删除 PKCS #11 对象。 根据从运行 LIST_OBJECTS 命令并使用具有下列属性的相同模板产生的对象的编号列表删除对象:
p11_label = “<string>”
p11_class = “<PKCS#11 Object Class>”
p11_private = “<boolean>”
p11_trusted = “<boolean>”
p11_sensitive = “<boolean>”
p11_login = “<boolean>”
注意: 由于未在批处理之间维护令牌状态和一致性,因此可能会无意中删除对象。 如果通过最初列示对象时与删除该对象时之间对相同令牌运行的其他进程添加或删除对象,那么对象的所列示顺序会更改。
必需属性
action_name = “DELETE_OBJECTS”
p11_driver = “<driver name>”
p11_slot = “<slot number>”
p11_objects = “<CSV>”

其中< CSV >可以是单词ALL(表示所有标记对象),也可以是正整数值的逗号分隔列表,这些数值对应对象按出现顺序编号,具体可通过以下可选属性实现。

可选属性
p11_label = “<string>”
p11_class = “<PKCS#11 Object Class>”
p11_private = “<boolean>”
p11_trusted = “<boolean>”
p11_sensitive = “<boolean>”
p11_login = “<boolean>”
start_gui = “<boolean>”
示例
[p11km_cmd_delete_seven_objects]
action_name = “DELETE_OBJECTS”
p11_slot = “0”
p11_driver = “AIX”
p11_objects = “1,5,10,11,12,27,33”
p11_login = “TRUE”
移动 PKCS #11 对象:
移动 PKCS #11 对象。 根据从运行 LIST_OBJECTS 命令并使用相同模板产生的对象的编号列表移动对象。
注意: 由于未在批处理之间维护令牌状态和一致性,因此可能会无意中移动对象。 如果通过在最初列示对象时与移动该对象时之间对照相同令牌运行的其他进程添加或删除对象,那么对象的所列示顺序会更改。
必需属性
action_name = “MOVE_OBJECTS”
############################################
###### Source Token Identification: ######
p11_driver = “<driver name>”
p11_slot = “<slot number>”
############################################
###### Target Token Identification: ######
p11_driver_target = “<driver name>”
p11_slot_target = “<slot number>”
############################################
###### Objects being moved to target: ######
p11_objects = “<CSV>”
可选属性
p11_label = “<string>”
p11_class = “<PKCS#11 Object Class>”
p11_private = “<boolean>”
p11_trusted = “<boolean>”
p11_sensitive = “<boolean>”
p11_login = “<boolean>”
start_gui = “<boolean>”
示例
[p11km_cmd_move_three_objects]
action_name = “MOVE_OBJECTS”
p11_slot = “0”
p11_slot_target = “1”
p11_driver = “AIX”
p11_driver_target = “AIX”
p11_objects = “15,20,60”
p11_login = “FALSE”
复制 PKCS #11 对象
复制 PKCS #11 对象。 根据从运行 LIST_OBJECTS 命令并使用相同模板产生的对象的编号列表复制对象。
注意: 由于未在批处理过程之间维护令牌状态和一致性,因此可能会无意中复制对象。 如果通过由在最初列示对象时与复制该对象时之间对照相同令牌运行的其他进程添加或删除对象,那么对象的所列示顺序会更改。
必需属性
action_name = “COPY_OBJECTS”
p11_driver = “<driver name>”
p11_slot = “<slot number>”
p11_driver_target = “<driver name>”
p11_slot_target = “<slot number>”
p11_objects = “<CSV>”
可选属性
p11_label = “<string>”
p11_class = “<PKCS#11 Object Class>”
p11_private = “<boolean>”
p11_trusted = “<boolean>”
p11_sensitive = “<boolean>”
p11_login = “<boolean>”
start_gui = “<boolean>”
示例
[p11km_cmd_copy_one_private_object]
action_name = “COPY_OBJECTS”
p11_slot = “0”
p11_slot_target = “1”
p11_driver = “AIX”
p11_driver_target = “AIX”
p11_objects = “3”
p11_login = “TRUE” ## REQUIRED FOR PRIVATE OBJECT MGT.
导出 PKCS #11 对象并将其备份到文件中
导出和备份 PKCS #11 对象。 根据从运行 LIST_OBJECTS 命令并使用相同模板产生的对象的编号列表导出并备份对象。
注意: 由于未在批处理进程之间维护令牌状态和一致性,因此可能会无意中导出对象。 如果通过由在最初列示对象时与导出该对象时之间对照相同令牌运行的其他进程添加或删除对象,那么对象的所列示顺序会更改。
必需属性
action_name = “EXPORT_OBJECTS”
p11_driver = “<driver name>”
p11_slot = “<slot number>”
p11_object_file = “<file name>”
p11_objects = “<CSV>”
可选属性
p11_label = “<string>”
p11_class = “<PKCS#11 Object Class>”
p11_private = “<boolean>”
p11_trusted = “<boolean>”
p11_sensitive = “<boolean>”
p11_login = “<boolean>”
start_gui = “<boolean>”
示例
[p11km_cmd_backup_objects]
action_name = “EXPORT_OBJECTS”
p11_slot = “0”
p11_driver = “AIX”
p11_objects = “ALL”
p11_login = “TRUE”
p11_object_file = “/home/user1/p11km.backup”
从文件中导入 PKCS #11 对象
导入已从 PKCS #11 导出文件创建的 PKCS #11 对象。
必需属性
action_name = “IMPORT_OBJECTS”
p11_driver = “<driver name>”
p11_slot = “<slot number>”
p11_object_file = “<file name>”
可选属性
p11_login = “<boolean>” # REQUIRED TO IMPORT ANY PRIVATE OBJECTS
start_gui = “<boolean>”
示例
[p11km_cmd_import_my_backed_up_objects]
action_name = “IMPORT_OBJECTS”
p11_slot = “0”
p11_driver = “AIX”
p11_login = “TRUE”
p11_object_file = “/home/user1/p11km.backup”
创建自签名证书
创建自签名 X.509 证书以及 PKCS #11 令牌的关联 PKCS #11 对象。
必需属性
action_name = “CREATE_SSC”
p11_driver = “<driver name>”
p11_slot = “<slot number>”
p11_login = “TRUE”
p11_ssc_label = “<string>”
p11_ssc_config = “<openssl configuration file>”

Where <openssl 配置文件> is the full UNIX path and filename of an OpenSSL configuration file that is populated with values that are used in creating the self-signed certificate.

可选属性
start_gui = “<boolean>”
示例
[p11km_cmd_self_signed_certificate]
action_name = “CREATE_SSC”
p11_slot = “0”
p11_driver = “AIX”
p11_login = “TRUE”
p11_ssc_label = “Lab RADIUS Server”
p11_ssc_config = “/etc/radius/EAP-TLS/openssl.cnf”
创建 PKCS #10 证书签名请求
创建 PKCS #10 认证请求或证书签名请求(CSR)。
必需属性
action_name = “CREATE_CSR”
p11_driver = “<driver name>”
p11_slot = “<slot number>”
p11_login = “TRUE”
p11_csr_label = “<string>”
p11_csr_file = “<path to CSR output file>”
p11_csr_type = “<DER or Base64>'
p11_csr_config = “<openssl configuration file>”

Where <DER 或 Base64> either generates an ASN.1 (DER) encoded CSR output file or a Base64-encoded CSR output file and <CSR 输出文件的路径> refers to the full UNIX path and filename to the CSR output.

可选属性
start_gui = “<boolean>”
示例
[p11km_cmd_my_pkcs10_base64]
action_name = “CREATE_SSC”
p11_slot = “0”
p11_driver = “AIX”
p11_login = “TRUE”
p11_csr_label = “Lab RADIUS Server”
p11_csr_type = “Base64”
p11_csr_file = “/etc/radius/EAP-TLS/certreq.b64”
p11_csr_config = “/etc/radius/EAP-TLS/openssl.cnf”

在 PKCS #11 管理工具(p11admin)中,下列批处理命令可用。

注: 要使用批处理命令,请执行以下操作:
  1. 创建和编辑批处理文件,如 批处理中所述。
  2. 创建新的 p11km_cmd 部分,它们包含要使用的批处理命令的属性。
列示可用的 PKCS #11 令牌
生成报告并显示可用 PKCS #11 令牌的令牌和插槽信息。
必需属性
action_name = “ADM_LIST_TOKENS”
可选属性
start_gui = “<boolean>”

Where <布尔> is eitherTRUE or FALSE

示例
[p11admin_cmd_list_tokens]
action_name = “ADM_LIST_TOKENS”
列示可用的 PKCS#11 机制
生成报告并显示受 PKCS #11 令牌(通过指定驱动程序和插槽属性值来匹配)支持的可用 PKCS #11 机制。
必需属性
action_name = “ADM_LIST_MECHANISMS”
p11_driver = “<driver name>”
p11_slot = “<slot number>”
Where <插槽号> is a positive integer value, and <驱动程序名称> is one of the following values:
描述
AIX AIX 操作系统加密框架
IBM_4758_4960 IBM 4758/4960 加密硬件适配器
IBM_4764 IBM 4764 加密硬件适配器
其他 如果指定 OTHER,那么还必须指定 p11_driver_path 属性。
可选属性
start_gui = “<boolean>”
补充属性
p11_driver_path = “<path to PKCS#11 driver>”

Where <PKCS#11 驱动程序的路径> is the full UNIX path and filename of the PKCS #11 library that is used for the command. 仅当 p11_driver 属性设置为 OTHER 时,可以指定此属性。

示例
[p11admin_cmd_list_4764_slot_0_mechs]
action_name = “ADM_LIST_MECHANISMS”
p11_driver = “IBM_4764”
p11_slot = “0”
start_gui = “TRUE”
显示 PKCS #11 令牌的信息
显示 PKCS #11 令牌的 PKCS #11 令牌和插槽信息。
必需属性
action_name = “ADM_SHOW_TOKEN_INFO”
p11_driver = “<driver name>”
p11_slot = “<slot number>”
可选属性
start_gui = “<boolean>”
示例
[p11admin_cmd]
action_name = “ADM_SHOW_TOKEN_INFO”
p11_slot = “411”
p11_driver = “IBM_4764”
初始化 PKCS #11 令牌:
初始化 PKCS #11 令牌。 初始化会复位该令牌,擦除所有已存储的 PKCS#11 对象和数据,以及允许重新标注该令牌。
注意: 由于在初始化过程中擦除了所有 PKCS #11 对象和数据,因此请确保在初始化 PKCS #11 令牌之前不需要这些对象和数据。
必需属性
action_name = “ADM_INIT_TOKEN”
p11_driver = “<driver name>”
p11_slot = “<slot number>” ## SAME AS 'p11_init_slot'
p11_init_slot = “<slot number>” ## SAME AS 'p11_slot'
p11_init_label = “<string>” ## NEW TOKEN LABEL
可选属性
start_gui = “<boolean>”
示例
[p11admin_cmd]
action_name = “ADM_INIT_TOKEN”
p11_slot = “1”
p11_driver = “IBM_4764”
p11_init_slot = “1”
p11_init_label = “ABC Token”
查看 PKCS #11 令牌的时钟
当 PKCS #11 令牌具有硬件时钟时显示该令牌的时钟。
必需属性
action_name = “ADM_CLOCK_VIEW”
p11_driver = “<driver name>”
p11_slot = “<slot number>”
可选属性
start_gui = “<boolean>”
示例
[p11admin_cmd]
action_name = “ADM_CLOCK_VIEW”
p11_slot = “1”
p11_driver = “IBM_4764”
设置 PKCS #11 令牌的时钟
当 PKCS #11 令牌具有硬件时钟时设置该令牌的时钟。
必需属性
action_name = “ADM_CLOCK_SET”
p11_driver = “<driver name>”
p11_slot = “<slot number>”
p11_clock_set = “<clock data>”

Where <时钟数据> is the current UTC date and time with the following format: HH:MM:SS mm-dd-YYYY.

可选属性
start_gui = “<boolean>”
示例
[p11admin_cmd]
action_name = “ADM_CLOCK_SET”
p11_slot = “1”
p11_driver = “IBM_4764”
p11_clock_set = “23:59:59 12-31-1999”
复位 PKCS #11 令牌用户的 PIN
复位 PKCS #11 令牌用户的 PIN。
必需属性
action_name = “ADM_RESET_USER_PIN”
p11_driver = “<driver name>”
p11_slot = “<slot number>”
可选属性
start_gui = “<boolean>”
示例
[p11admin_cmd_change_so_pin]
action_name = “ADM_RESET_USER_PIN”
p11_driver = “AIX”
p11_slot = “0”
更改 PKCS #11 令牌安全主管的 PIN
更改 PKCS #11 令牌安全主管的 PIN。 执行令牌管理时会使用此 PIN。
必需属性
action_name = “ADM_CHANGE_SO_PIN”
p11_driver = “<driver name>”
p11_slot = “<slot number>”
可选属性
start_gui = “<boolean>”
示例
[p11admin_cmd_change_so_pin]
action_name = “ADM_CHANGE_SO_PIN”
p11_slot = “888”
p11_driver = “IBM_4764”