转换RSA私钥 - ConvertRSAPrivateKey
函数简介
将RSA私钥从一种格式转换为另一种格式。
接口名称
ConvertRSAPrivateKey
DLL调用
long ConvertRSAPrivateKey(long instance, string privateKey, int inputType, int outputType);
参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| instance | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| privateKey | 字符串 | 要转换的私钥。 |
| 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 = ConvertRSAPrivateKey(instance, pemPrivateKey, 0, 1);
char* xmlPrivateKey = GetStringFromPtr(ptr);
FreeStringPtr(ptr);
Python
# 待补充
返回值
成功返回转换后的私钥字符串的指针;失败返回0。返回的字符串指针需要调用 FreeStringPtr 接口释放内存。
