2.3 KiB
2.3 KiB
Object - TRSA 非对称加密
TRSA
声明:class
提供 RSA 非对称加密、解密和签名能力的内置对象
create()
声明:function
无参数构造函数。创建 TRSA 实例
可见性:public
priDecrypt(s)
声明:function
对字符串s的内容用私钥解密
可见性:public
| 参数 | 类型 | 说明 |
|---|---|---|
s |
any | s |
返回:string
priEncrypt(s)
声明:function
对字符串s的内容用私钥加密
可见性:public
| 参数 | 类型 | 说明 |
|---|---|---|
s |
any | s |
返回:string
pubDecrypt(s)
声明:function
对字符串s的内容用公钥解密
可见性:public
| 参数 | 类型 | 说明 |
|---|---|---|
s |
any | s |
返回:string
pubEncrypt(s)
声明:function
对字符串s的内容用公钥加密
可见性:public
| 参数 | 类型 | 说明 |
|---|---|---|
s |
any | s |
返回:string
generateKey(bits)
声明:function
生成指定位数的公钥和私钥,位数必须是256的正整数倍,最大4096
可见性:public
| 参数 | 类型 | 说明 |
|---|---|---|
bits |
integer | 密钥位数,必须是 256 的正整数倍且不超过 4096 |
示例
范例01:生成 1024 位密钥
obj := new TRSA();
obj.generateKey(1024);
return length(obj.publicKey) > 0;
// 输出:1
PrivateKey
声明:property
获取或设置私钥
可见性:public
类型:string
访问:read/write
PublicKey
声明:property
获取或设置公钥
可见性:public
类型:string
访问:read/write