To create an ECDSA Certificate Verify. we need a signed hash. Using a Private ECC Key Blob:
produces a 64 byte signature for "ECDSA_P256". At the other end we are supposed to use the Public Key Blob to verify the sender has the private key:
produces a STATUS_INVALID_PARAMETER error. The Private and Public keys were produced by OpenSSL, less the leading "No Compression byte &H04).
Anyone have any idea what the problem is?
J.A. Coutts
Code:
If BCryptOpenAlgorithmProvider(hProv, hAlg, StrPtr("Microsoft Primitive Provider"), 0) <> 0 Then GoTo ReleaseHandles
cbPrivBlob = GetbSize(bPrivateECCKey)
If BCryptImportKeyPair(hProv, 0&, StrPtr("ECCPRIVATEBLOB"), hPrivKey, VarPtr(bPrivateECCKey(0)), cbPrivBlob, 0) <> 0 then GoTo ReleaseHandles
'Get size of Signature
lRet = BCryptSignHash(hPrivKey, ByVal 0, bTmp(0), GetbSize(bTmp), ByVal 0, 0, lLen, 0)
'No error
If lRet = 0 Then
ReDim bVerify(lLen - 1)
If BCryptSignHash(hPrivKey, ByVal 0, bTmp(0), GetbSize(bTmp), bVerify(0), GetbSize(bVerify), lLen, 0) <> 0 Then GoTo ReleaseHandles
End If
Code:
If BCryptOpenAlgorithmProvider(hProv, hAlg, StrPtr("Microsoft Primitive Provider"), 0) <> 0 Then GoTo ReleaseHandles
cbPubBlob = GetbSize(bPublicECCKey)
If BCryptImportKeyPair(hProv, 0&, StrPtr("ECCPUBLICBLOB"), hPubKey, VarPtr(bPublicECCKey(0)), cbPubBlob, 0) <> 0 then GoTo ReleaseHandles
'Get size of Signature
lRet = BCryptSignHash(hPubKey, ByVal 0, bTmp(0), GetbSize(bTmp), ByVal 0, 0, lLen, 0)
'Returns error &HC0000000D
If lRet = 0 Then
ReDim bVerify(lLen - 1)
If BCryptSignHash(hPubKey, ByVal 0, bTmp(0), GetbSize(bTmp), bVerify(0), GetbSize(bVerify), lLen, 0) <> 0 Then GoTo ReleaseHandles
End If
Anyone have any idea what the problem is?
J.A. Coutts