小编Jua*_*ero的帖子

c# RSACryptoServiceProvider 中的指数和模数是什么类型的数据?

我在 c# 中使用 RSACryptoServiceProvider 生成了公钥:

<RSAKeyValue>
   <Modulus>
      4kKhD/FWAMtQTRifArfXjxZN+6bOXTkHrVpyz/1wODhSOBqDewoSOFAp5boBd3wFjXszHA+gpUxZNWHRTj898Q==
   </Modulus>
   <Exponent>
      AQAB
   </Exponent>
<RSAKeyValue>
Run Code Online (Sandbox Code Playgroud)

这些参数是在 512 位初始化的 RSA 变量中生成的

new RSACryptoServiceProvider(512)    
Run Code Online (Sandbox Code Playgroud)

现在,我需要使用这些(模数和指数)来加密一些数据,但是在 groovy 中(SoapUI 测试中的 groovyscript)。在 groovy 中,我正在测试 RSA 加密,对于它的公钥,它只获取十进制数的模数和指数。上面的 Modulus 看起来像一个 base64 字符串,但是当我尝试在 groovy 中解码时,它得到了一些特殊字符,我使用的代码是

byte[] decoded = encoded.decodeBase64()
string s == new String(decoded)
Run Code Online (Sandbox Code Playgroud)

我最终需要的是知道如何使用在 c# 中获得的模数和指数来加密 groovy 中的一些数据。一些帮助如何做到这一点?

c# groovy rsa exponent modulus

5
推荐指数
1
解决办法
4818
查看次数

字符串到十进制显示总是两位小数

我有这个字符串"121,121.00",我需要转换为小数,以给前端这个'121121.00'.我已经尝试了很多,但我还不能做到.这里有一些我试过的代码和他们给我的结果:

string var = "121,121.00"

decimal d = decimal.Parse(var, NumberStyles.AllowThousands | NumberStyles.AllowDecimalPoint);
// it gives me '12112100'  

decimal d = decimal.Parse(var, NumberStyles.Currency);
// it gives me '12112100' 

decimal d = decimal.Parse((var.Replace(",","")), NumberStyles.Currency);
// and it gives me '12112100' too
Run Code Online (Sandbox Code Playgroud)

c# string decimal

0
推荐指数
1
解决办法
94
查看次数

标签 统计

c# ×2

decimal ×1

exponent ×1

groovy ×1

modulus ×1

rsa ×1

string ×1