什么是"验证"功能RSAKey(AS3Crypto)呢? [英] What does the "verify" function in RSAKey (AS3Crypto) does?
问题描述
我真的不明白的_verify功能确实在这个类的内容:
I really don't understand what the _verify function does in this class :
<一个href="http://$c$c.google.com/p/as3crypto/source/browse/trunk/as3crypto/src/com/hurlant/crypto/rsa/RSAKey.as" rel="nofollow">http://$c$c.google.com/p/as3crypto/source/browse/trunk/as3crypto/src/com/hurlant/crypto/rsa/RSAKey.as
和尤其是什么装进DST变量。其实我有上的加密数据的确认键至极使用这种方法,我也得到了DST变量公钥...
And especially what does it put into the 'dst' variable. I actually have a "verify key" wich use this method on an encrypted data, and I get the public key in the dst variable...
下面是一个小图,让你更好地理解: http://i.imgur.com/ R8DqT.png
Here is a small diagram, so that you understand better: http://i.imgur.com/R8DqT.png
感谢
PS:我必须做在.net中是相同的,所以如果你知道的东西相当,让我知道它
Ps : I have to do the same in .net,so if you know something equivalent, let me know it
推荐答案
函数_verify(包括下面的参考)
The function _verify (included for reference below)
public function verify(src:ByteArray, dst:ByteArray,
length:uint, pad:Function = null):void {
_decrypt(doPublic, src, dst, length, pad, 0x01);
}
纵观<一href="http://$c$c.google.com/p/as3crypto/source/browse/trunk/as3crypto/src/com/hurlant/crypto/rsa/RSAKey.as"相对=nofollow>链接您所提供的功能是用于验证RSA签名的数据 - 在将结果复制到DST的ByteArray。
Looking at the link you supplied, the function is used to verify RSA signed data - the result is copied to the dst ByteArray.
分析:
-
doPublic
=功能参数,各地包装BigInteger.modPowInt()
-
的src
=字节数组签名的数据 -
DST
=字节数组将举行的核查结果,结果 -
长度
=在SRC字节数组 数据的长度
-
垫
=函数参数,一个包装pkcs1pad
(<$ C C $> _encrypt )和pkcs1unpad
(_decrypt
) -
0×01
= padType - 一个整数值,指定,如果一个固定值(0xFF的
)用于填充(0×01 )或伪随机的(0X02) - (仅在pkcs1pad
实际使用它是由一个名为_encrypt
)
doPublic
= function parameter, a wrapper aroundBigInteger.modPowInt()
src
= byte array with signed datadst
= byte array which will hold the result of with verification resultlength
= length of the data in src byte arraypad
= function parameter, a wrapper forpkcs1pad
(_encrypt
) andpkcs1unpad
(_decrypt
)0x01
= padType - an integer value specifying if a fixed value (0xff
) is used in padding (0x01) or a pseudo-random one (0x02) - (only actually used inpkcs1pad
which is called from_encrypt
)
在RSA方法,签名数据是通过使用公共密钥解密该签名验证
In the RSA scheme, signed data is verified by decrypting the signature using the public key.
更新:除非你有未涵盖的特殊需求,就是看你为什么要端口的ActionScript 3你贴什么理由。使用C#<一href="http://msdn.microsoft.com/en-us/library/system.security.cryptography.rsacryptoserviceprovider.aspx"相对=nofollow>的RSACryptoServiceProvider 的被包括在所述框架。需要特别注意的部分互操作与Microsoft加密API(CAPI)
在MSDN描述。
Update: Unless you have very specific needs which are not covered, is see no reason why you want to port the ActionScript-3 you posted. Use the c# RSACryptoServiceProvider which is included in the framework. Take special note of the section Interoperation with the Microsoft Cryptographic API (CAPI)
in the MSDN description.
解决您的评论对需要的 DST
的内容字节数组以类似的方式向AS3Crypto实现你可以只创建一个包装已签署的数据进行解密针对公众键。看一看<一href="http://msdn.microsoft.com/en-us/library/system.security.cryptography.rsacryptoserviceprovider.importparameters.aspx"相对=nofollow> RSACryptoServiceProvider.ImportParameters(),您可以用它来导入公钥信息功能。既然你没有提供细节如何公钥检索,我不能更具体。此实现例如应该帮助分析密钥文件来创建相应的 RSAParameters
喂到 ImportParameters
方法。
Addressing your comments about needing the content of the dst
byte array in a similar manner to the AS3Crypto implementation you could just create a wrapper to decrypt the signed data against the public key. Have a look at RSACryptoServiceProvider.ImportParameters() function which you use to import the public key information. Since you haven't provided details as to how the public key is retrieved I can't be more specific. This implementation example should help with parsing key files to create appropriate RSAParameters
to feed to the ImportParameters
method.
这篇关于什么是&QUOT;验证&QUOT;功能RSAKey(AS3Crypto)呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!