- 概述
- 加密
- 数据库
- Java
- Python
- 网页 API
“解密文本”活动用于使用对称算法和密钥或使用 PGP 私钥解密字符串。
UiPath.Cryptography.Activities.DecryptText
描述
使用对称算法和密钥或使用带有私钥的 PGP 对字符串进行解密。返回明文字符串。加密输入对于对称算法进行 Base64 编码,对于 PGP 进行 ASCII 防护。
项目兼容性
Windows - 旧版 | Windows | 跨平台
Windows、跨平台配置
- 算法- 此为下拉菜单,用于选择要使用的解密算法。提供以下选项: AES GCM 、 ChaCha20-Poly1305(非 FIPS) 、 PGP - 相当良好的隐私协议(非 FIPS) 、 AES(已弃用) 、 DES (已弃用) 、 RC2 (非 FIPS)(已弃用) 、 Rijndael (非 FIPS)(已弃用)和TripleDES(已弃用) 。选择“PGP” ,以使用私钥而不是对称密钥进行解密。该算法必须与用于加密输入的算法匹配。
- Text - The text that you want to decrypt. This field supports only strings and
Stringvariables. - 密钥- 要用于解密指定文本的密钥。仅由对称算法使用。此字段仅支持字符串和
String变量。要以安全字符串而非纯文本形式输入密钥,请选择字段的输入菜单,然后选择“切换到安全输入” - 这将使用密钥安全字符串属性(aSecureString)。
高级选项
选项
- 密钥编码- 用于解释在“密钥”属性中指定的密钥的编码。仅由对称算法使用。下拉列表中列出了计算机上所有可用的文本编码(代码页),首先显示最常见的编码:系统默认值、 Unicode (UTF-8) (默认选项)、 Unicode 、 Unicode (Big-Endian) 、 Unicode (UTF-32 ) 、 Unicode (UTF-32 Big-Endian) 、 US-ASCII和西欧 (ISO) 。列表中遵循其他区域和旧版代码页。
- 文本编码- 用于将解密的字节转换回文本的编码。设置此项以匹配生成密文的工具所使用的编码。独立于按键编码- 两者都提供相同的完整文本编码列表,并默认为Unicode (UTF-8) 。仅由对称算法使用。
- Continue On Error - Specifies if the automation should continue even if the activity throws an error. This field only supports Boolean values (
True,False). The default value isFalse. As a result, if the field is blank and an error is thrown, the execution of the project stops. If the value is set toTrue, the execution of the project continues regardless of any error.
对称连线格式和互操作性
这些选项仅适用于对称算法。它们可用于解密由外部工具(例如openssl enc 、Java 和 Python)生成的密文。每个选项都必须与加密时使用的选项匹配。
- 传输格式- 要解密的对称密文布局。必须与加密时使用的格式匹配。可选择以下选项:
- UiPath(传统) (默认)- UiPath 的字节稳定布局(
salt(8) + IV + ciphertext [+ tag],迭代次数为 10,000 次时为 pilot2-HMAC-SHA1)。初始化向量(如果存在)会自动从密文流前缀中读取。 - UiPath (OWASP 2026) - 传统布局,具有更强的 OWASP 建议的 KFS 迭代计数。
- 原始(调用者提供的密钥和 PV) - 调用者提供的密钥,用于第三方互操作性。要求密钥字节格式为Hex或Base64 。
- OpenSSL ec(Salted__ + VBKDM2-SHA256) - 解密
openssl enc兼容的输入。
- UiPath(传统) (默认)- UiPath 的字节稳定布局(
- 密钥字节格式- 如何解释“密钥”字符串。提供以下选项: “Hex”和“Base64” 。当“线格式”为“原始”(调用者提供的密钥和初始化向量)时为必填项;否则,密钥将被视为密码。
- “Kdf 迭代” - pbkdf2 迭代计数。必须匹配加密时使用的值,因为它不以传输格式传递。
0使用 OWASP 推荐的格式默认值。UiPath(传统)和原始数据(调用者提供的密钥和初始化密钥)已被拒绝。 - “AES 密钥大小” - 用于加密输入的 AES 密钥大小(以位为单位)。可用的选项如下: 128 位、 192 位和256 位(默认)。仅当“算法”为“AES”且“传输格式”为OpenSSL ec (Salted__ + PI-SHA256)时适用。必须与生产者使用的密钥大小匹配;该文件不会以连线格式存储。
PGP
当“算法”为“PGP”时,这些选项适用。
- 私钥文件路径- PGP 私钥文件的路径。当“算法”为“PGP”时为必需。
- 密码短语- 用于解锁私钥的密码短语。要将其作为安全字符串而不是纯文本,请选择字段的输入菜单,然后切换到“密码(安全)”输入(a
SecureString)。 - 验证签名- 启用后,使用公钥验证解密数据的 PGP 签名。该字段仅支持“布尔值”(
True和False)。默认值为False。 - 公钥文件路径- 签名者的 PGP 公钥文件的路径。仅在启用“验证签名”时才需要。
输出
- Decrypted Text - Reference to the decrypted text stored in a
Stringvariable for use in other activities.
Windows - 旧版配置
属性面板
常见
- Continue On Error - Specifies if the automation should continue even if the activity throws an error. This field only supports Boolean values (
True,False). The default value isFalse. As a result, if the field is blank and an error is thrown, the execution of the project stops. If the value is set toTrue, the execution of the project continues regardless of any error.备注:如果“Try Catch 异常处理”中包含该活动且“出错时继续”属性的值为“
True”,则系统在执行项目时不会捕获任何错误。 - “显示名称”- 活动的显示名称。
输入
-
Algorithm - A drop-down menu which enables you to select the decryption 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 位生成的密钥与“密钥输入”选项不同。
-
编码- 用于解释在密钥属性中指定的输入文本和密钥的编码。此字段仅支持
Encoding变量。有关此变量类型的更多信息,请查看Microsoft 官方文档。 -
Key - The key that you want to use to decrypt the specified file. This field supports only strings and
Stringvariables. -
Key Secure String - The secure string used to decrypt the input string.
-
Text - The text that you want to decrypt. This field supports only strings and
Stringvariables.
其他
- “私有”- 选中后将不再以“Verbose”级别记录变量和参数的值。
输出
- Result - The decrypted text, stored in a
Stringvariable.