CngAlgorithm.ECDiffieHellmanP521/P256/P384生成的EccPrivateBlob的CngKeyBlobFormat是什么?
what is the CngKeyBlobFormat of EccPrivateBlob generated by CngAlgorithm.ECDiffieHellmanP521/P256/P384?
CngKey key = CngKey.Create(CngAlgorithm.ECDiffieHellmanP521, null,
new CngKeyCreationParameters { ExportPolicy = CngExportPolicies.AllowPlaintextExport });
byte[] keyBlob= key.Export(CngKeyBlobFormat.EccPrivateBlob);
keyBlob的长度是206,它的格式是什么? 32字节的私钥和64字节的public密钥分别是哪些字节?
在Import a Public key from somewhere else to CngKey?,长度为4+4+64+32=104。
所有三条曲线的斑点二进制结构都相同:
<magic number, 4 bytes><modulus length in bytes, 4 bytes><x-value of public key><y-value of public key><private key>
详细适用:
secp256r1 / NIST P-256
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
secp384r1/NIST P-384
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
secp521r1 / NIST P-521
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
私钥和 public 密钥的 x
- 和 y
- 组件以大端格式存储。所有三个分量都具有模数的长度。因此,斑点的不同长度是由曲线的不同模量引起的。
另请参阅:SECG, SEC2, key blob format, magic numbers, format of ECCPublicBlob and ECCPrivateBlob
CngKey key = CngKey.Create(CngAlgorithm.ECDiffieHellmanP521, null,
new CngKeyCreationParameters { ExportPolicy = CngExportPolicies.AllowPlaintextExport });
byte[] keyBlob= key.Export(CngKeyBlobFormat.EccPrivateBlob);
keyBlob的长度是206,它的格式是什么? 32字节的私钥和64字节的public密钥分别是哪些字节?
在Import a Public key from somewhere else to CngKey?,长度为4+4+64+32=104。
所有三条曲线的斑点二进制结构都相同:
<magic number, 4 bytes><modulus length in bytes, 4 bytes><x-value of public key><y-value of public key><private key>
详细适用:
secp256r1 / NIST P-256
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
secp384r1/NIST P-384
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
secp521r1 / NIST P-521
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
私钥和 public 密钥的 x
- 和 y
- 组件以大端格式存储。所有三个分量都具有模数的长度。因此,斑点的不同长度是由曲线的不同模量引起的。
另请参阅:SECG, SEC2, key blob format, magic numbers, format of ECCPublicBlob and ECCPrivateBlob