UiPath Documentation
activities
latest
false
重要 :
请注意,此内容已使用机器翻译进行了部分本地化。 新发布内容的本地化可能需要 1-2 周的时间才能完成。

开发者活动

加密文件

UiPath.Cryptography.Activities.EncryptFile

描述

Encrypts a file using a symmetric algorithm and key, or using PGP with a recipient's public key. The result is written to a new file.

项目兼容性

Windows - 旧版 | Windows | 跨平台

Windows、跨平台配置

  • 文件- 要加密的文件,存储为IResource变量。选择加号。文档图像菜单以切换到“输入路径”输入。
  • Algorithm - A drop-down menu which enables you to select the encryption algorithm you want to use. The following options are available: AES GCM, ChaCha20-Poly1305 (Non-FIPS), PGP - Pretty Good Privacy (Non-FIPS), AES (Deprecated), DES (Deprecated), RC2 (Non-FIPS) (Deprecated), Rijndael (Non-FIPS) (Deprecated), and TripleDES (Deprecated). AES GCM and ChaCha20-Poly1305 (Non-FIPS) are authenticated (AEAD) algorithms recommended for new workflows. Select PGP to encrypt with a recipient's public key instead of a symmetric key.
  • Key - The key that you want to use to encrypt the file. Used by the symmetric algorithms only. This field supports only strings and String variables. To enter the key as a secure string instead of plain text, select the field's input menu and choose Toggle to Secure input - this uses the Key Secure String property (a SecureString).

高级选项

选项
  • Key Encoding - The encoding used to interpret the key specified in the Key property. The dropdown lists all text encodings (code pages) available on the machine, with the most common ones shown first: System default, Unicode (UTF-8) (default), Unicode, Unicode (Big-Endian), Unicode (UTF-32), Unicode (UTF-32 Big-Endian), US-ASCII, and Western European (ISO). Additional regional and legacy code pages follow in the list.
  • Output file name and location - The path where you want to save the encrypted file. This field supports only strings and String variables.
    备注:

    建议使用相对文件夹路径,以解决执行项目时 Windows 和 Linux 计算机之间不同的文件结构。相对路径采用newFolder/newFileName.enc格式。如果目标文件夹尚不存在,则活动将创建该文件夹。

  • Overwrite - If a file already exists, selecting On overwrites it. If the toggle is set to Off, a new file is created. The default value is Off.
  • “出错时继续”- 指定在活动抛出错误时是否应继续自动化操作。该字段仅支持“布尔值”(TrueFalse)。默认值为 False。因此,如果该字段为空且活动引发错误,系统将停止执行项目。如果该值设为“True”,则无论出现何种错误,系统都将继续执行项目。
Symmetric wire format and interoperability

These options apply to the symmetric algorithms only. They let you produce ciphertext that interoperates with external tools such as openssl enc, Java, and Python. Existing workflows that do not set Wire format keep producing the default Classic output, which is unchanged.

  • Wire Format - The symmetric ciphertext layout. The following options are available:
    • UiPath (Classic) (default) - UiPath's byte-stable layout (salt(8) + IV + ciphertext [+ tag], PBKDF2-HMAC-SHA1 at 10,000 iterations). Produces the same output as previous versions.
    • UiPath (OWASP 2026) - The Classic layout with a stronger, OWASP-recommended KDF iteration count.
    • Raw (caller-supplied key and IV) - A caller-supplied key and IV, for third-party interoperability. Requires Key Bytes Format to be Hex or Base64.
    • OpenSSL enc (Salted__ + PBKDF2-SHA256) - Produces openssl enc-compatible output.
  • Key Bytes Format - How the Key string is interpreted. The following options are available: Hex and Base64. Required when Wire Format is Raw (caller-supplied key and IV); otherwise the key is treated as a password.
  • IV - The initialization vector, used when Wire Format is Raw (caller-supplied key and IV). Interpreted according to Key Bytes Format. Optional - leave it empty to let the cipher generate one. Rejected for all other formats.
  • KDF Iterations - The PBKDF2 iteration count. 0 uses the format's OWASP-recommended default (1,300,000 for UiPath (OWASP 2026), 600,000 for OpenSSL enc). Rejected for UiPath (Classic) and Raw (caller-supplied key and IV).
  • AES Key Size - The AES key size, in bits. The following options are available: 128-bit, 192-bit, and 256-bit (default). Applies only when Algorithm is AES and Wire Format is OpenSSL enc (Salted__ + PBKDF2-SHA256). Must match the key size the peer uses. It is not stored in the wire format, so the encrypt and decrypt sides must use matching values.
PGP

These options apply when Algorithm is PGP.

  • Public Key File Path - The path to the recipient's PGP public key file. Required when Algorithm is PGP.
  • Private Key File Path - The path to your PGP private key file. Required only when Sign Data is enabled.
  • Passphrase - The passphrase that unlocks your private key when signing. To provide it as a secure string instead of plain text, select the field's input menu and switch to the Passphrase (Secure) input (a SecureString).
  • Sign Data - When enabled, signs the encrypted data using your private key. This field only supports Boolean values (True, False). The default value is False.

根据输出路径以及文件已存在的情况,可能会出现以下结果:

输出文件的名称和位置覆盖输出结果
取消设置关闭具有原始文件名和后缀的文件“_Encrypted”。如果文件已存在,则会引发错误。
取消设置启动具有原始文件名和后缀的文件“_Encrypted”。如果文件已存在,则该文件将被覆盖。
集合关闭符合用户首选项的文件。如果文件已存在,则会引发错误。
集合启动符合用户首选项的文件。如果文件已存在,则该文件将被覆盖。
输出
  • Encrypted File - Reference to the encrypted file retrieved by the activity for use in other activities.

Windows - 旧版配置

属性面板

常见
  • “出错时继续”- 指定在活动抛出错误时是否应继续自动化操作。该字段仅支持“布尔值”(TrueFalse)。默认值为 False。因此,如果该字段为空且活动引发错误,系统将停止执行项目。如果该值设为“True”,则无论出现何种错误,系统都将继续执行项目。
    备注:

    如果“Try Catch 异常处理”中包含该活动且“出错时继续”属性的值为“True”,则系统在执行项目时不会捕获任何错误。

  • “显示名称”- 活动的显示名称。
输入
  • Algorithm - A drop-down menu which enables you to select the encryption algorithm you want to use. The following options are available: AES (Deprecated), AES GCM, DES (Deprecated), RC2 (Non-FIPS) (Deprecated), Rijndael (Non-FIPS) (Deprecated), and TripleDES.

    备注:

    使用AES GCM算法时,解密输入必须以(连接的字节)格式提供: Salt (8bytes) + IV (12 bytes) + encryptedData (variable bytes) + Tag (16 bytes) 。该活动还使用以下参数:

    • PBKDF2 迭代计数为 10000
    • 生成的密钥为 256 位(32 字节)

    请注意,256 位生成的密钥与“密钥输入”选项不同。

  • Encrypted Filename - The file name you want to use to save the encrypted file.

  • Input Path - The path to the file that you want to encrypt. This field supports only strings and String variables.

  • Key - The key that you want to use to encrypt the specified file. This field supports only strings and String variables.

  • Key Encoding - The encoding used to interpret the key specified in the Key property. This field supports only Encoding variables.

  • Key Secure String - The secure string used to encrypt the input file.

  • Output file name and location - The path where you want to save the encrypted file. This field supports only strings and String variables.

  • Overwrite - If a file already exists at the path specified in the OutputPath field, selecting this check box overwrites it. If unchecked, a new file is created. By default, this check box is cleared.

其他
  • “私有”- 选中后将不再以“Verbose”级别记录变量和参数的值。
  • 描述
  • 项目兼容性
  • Windows、跨平台配置
  • 高级选项
  • Windows - 旧版配置
  • 属性面板

此页面有帮助吗?

连接

需要帮助? 支持

想要了解详细内容? UiPath Academy

有问题? UiPath 论坛

保持更新