Exemplo n.º 1
0
 public RSA CreateRsaProviderFromPublicKey(string publicKeyString)
 {
     byte[] x509Key;
     if (!IsBase64)
     {
         //如果是十六进制,则将十六进制转为byte
         x509Key = HexByte.StrToToHexByte(publicKeyString);
     }
     else
     {
         //否则默认为base64
         x509Key = Convert.FromBase64String(publicKeyString);
     }
     return(CreateRsaProvider.CreateRsaProviderFromPublicKey(x509Key));
 }
Exemplo n.º 2
0
 public RSA CreateRsaProviderFromPrivateKey(string privateKey)
 {
     byte[] privateKeyBits;
     if (!IsBase64)
     {
         //如果是十六进制,则将十六进制转为byte
         privateKeyBits = HexByte.StrToToHexByte(privateKey);
     }
     else
     {
         //否则默认为base64
         privateKeyBits = Convert.FromBase64String(privateKey);
     }
     return(CreateRsaProvider.CreateRsaProviderFromPrivateKey(privateKeyBits));
 }