转换RSA公钥 - ConvertRSAPublicKey
函数简介
将RSA公钥从一种格式转换为另一种格式。
接口名称
ConvertRSAPublicKey
DLL调用
long ConvertRSAPublicKey(long instance, string publicKey, int inputType, int outputType);
参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| instance | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| publicKey | 字符串 | 要转换的公钥。 |
| inputType | 整数型 | 输入类型:0-pem格式;1-xml格式;2-PKCS1格式。 |
| outputType | 整数型 | 输出类型:0-pem格式;1-xml格式;2-PKCS1格式。 |
示例
C++
long instance = CreateCOLAPlugInterFace();
// 将PEM格式公钥转换为XML格式(inputType=0, outputType=1)
long ptr = ConvertRSAPublicKey(instance, pemPublicKey, 0, 1);
char* xmlPublicKey = GetStringFromPtr(ptr);
FreeStringPtr(ptr);
Python
# 待补充
返回值
成功返回转换后的公钥字符串的指针;失败返回0。返回的字符串指针需要调用 FreeStringPtr 接口释放内存。
