C# 由CngAlgorithm.ECDiffieHellmanP521/P256/P384生成的EccPrivateBlob的cngkeyblob格式是什么?
keyBlob的长度是206。它的格式是什么?哪些字节是32字节私钥和64字节公钥C# 由CngAlgorithm.ECDiffieHellmanP521/P256/P384生成的EccPrivateBlob的cngkeyblob格式是什么?,c#,cng,ecdh,C#,Cng,Ecdh,keyBlob的长度是206。它的格式是什么?哪些字节是32字节私钥和64字节公钥 此时,长度为4+4+64+32=104 BLOB的二元结构对于所有三条曲线都是相同的: CngKey key = CngKey.Create(CngAlgorithm.ECDiffieHellmanP521, null, new CngKeyCreationParameters { ExportPolicy = CngExportPolicies.AllowPlaintextExport }); b
此时,长度为4+4+64+32=104 BLOB的二元结构对于所有三条曲线都是相同的:
CngKey key = CngKey.Create(CngAlgorithm.ECDiffieHellmanP521, null,
new CngKeyCreationParameters { ExportPolicy = CngExportPolicies.AllowPlaintextExport });
byte[] keyBlob= key.Export(CngKeyBlobFormat.EccPrivateBlob);
具体适用于:
- secp256r1/NIST p-256
<magic number, 4 bytes><modulus length in bytes, 4 bytes><x-value of public key><y-value of public key><private key>
Private:45434B32 20000000总长度:104字节 公共:45434B31 20000000总长度:72字节
- secp384r1/NIST p-384
Private: 45434B32 20000000 <x-value of public key, 32 bytes><y-value of public key, 32 bytes><private key, 32 bytes> total length: 104 bytes Public: 45434B31 20000000 <x-value of public key, 32 bytes><y-value of public key, 32 bytes> total length: 72 bytes
Private:45434B34 30000000总长度:152字节 公共:45434B33 30000000总长度:104字节
- secp521r1/NIST p-521
Private: 45434B34 30000000 <x-value of public key, 48 bytes><y-value of public key, 48 bytes><private key, 48 bytes> total length: 152 bytes Public: 45434B33 30000000 <x-value of public key, 48 bytes><y-value of public key, 48 bytes> total length: 104 bytes
Private:45434B36 42000000总长度:206字节 公共:45434B35 42000000总长度:140字节
x
-和y
-组件以big-endian格式存储。所有三个分量都具有模量的长度。因此,斑点的不同长度是由曲线的不同模量引起的
另请参见:,它是一个字节[]。键接受字符串输入并创建类对象。字符串初始化类(就像随机数生成器的种子)。NSA的主要优势如下:我指的是CngKey Blob格式。哪些字节是206字节中的32字节私钥。正如我所说,字符串是伪随机生成器的种子,其输出是32字节数组。这是不可逆的。非常感谢!你能帮我提另一个问题吗?
Private: 45434B36 42000000 <x-value of public key, 66 bytes><y-value of public key, 66 bytes><private key, 66 bytes> total length: 206 bytes
Public: 45434B35 42000000 <x-value of public key, 66 bytes><y-value of public key, 66 bytes> total length: 140 bytes