ecdsa

AuthenticatAsClient fails with CRYPT_E_ASN1_BADTAG

与世无争的帅哥 提交于 2019-12-11 14:55:29
问题 I have written a .NET application that tries to do mutual authentication with an ECC client certificate (curve is brainpoolP384r1). The certificate is signed by a PKI and when I look at it in an ASN1 viewer it seems to be perfectly valid. I get the certificate byte data for this the following way: Console.WriteLine($"Certificate:{BitConverter.ToString(cert.RawData).Replace("-","")}"); Looking at the certificate in the MMC console it also appears to be valid. However, when I try to use it to

Understanding BCryptSignHash output signature

五迷三道 提交于 2019-12-11 13:46:24
问题 I have signed a hash value in windows using BCryptSignHash with ECDSA algorithm. The output signature buffer is of length 64 bytes. I also generated the public and private key blobs using BCryptGenerateKeyPair function (BCRYPT_ECDSA_P256_ALGORITHM algorithm) with which i signed the hash. I have to verify this signature with this key pair in linux. I am able to decipher the public-private key pair that got generated, using the link "http://msdn.microsoft.com/en-us/library/windows/desktop

How to create a digital signature using SHA256 with ECDSA algorithm in C#

笑着哭i 提交于 2019-12-11 11:48:43
问题 I have a requirement to create a signature which is a URL-Safe-Base-64-encoded SHA256+ECDSA signature of a message. This will be used to consume a remote REST service. I have been given a HAL browser implementation which connects to them as expected and a test implementation done in SCALA. val token = generateToken() // Generates a random numeric token, different for each request val lines = line1 + "\n" + line2 + "\n" + line3 + "\n" val lineBytes = lines.getBytes() try { var sig = Signature

How can I recover compressed y value from sender?

半城伤御伤魂 提交于 2019-12-11 07:19:34
问题 I am working on following scenario: Generate private and public key Generate compressed public key with: PublicKey.AccessGroupParameters().SetPointCompression(true) Sign some data and send to other end with compressed public key. [At other end] verify signature using public key For step 4, I need recover y value. Is there some API I can use among Crypto++? 回答1: For step 4, I need recover y value. Is there some API I can use among Crypto++? During verification, you will load the persisted or

Encryption in swift using Diffie Hellman key exchange and an elliptic curve encryption

倖福魔咒の 提交于 2019-12-11 06:24:35
问题 I've been trying to encrypt and decrypt a string in swift using a Diffie Hellman key exchange and an elliptic curve encryption. Following is the code that I followed. SWIFT Code : let attributes: [String: Any] = [kSecAttrKeySizeInBits as String: 256, kSecAttrKeyType as String: kSecAttrKeyTypeEC, kSecPrivateKeyAttrs as String: [kSecAttrIsPermanent as String: false]] var error: Unmanaged<CFError>? if #available(iOS 10.0, *) { **// Step 1: Generating the Public & Private Key** guard let

Can't read OpenSSL-generated ECDSA key from Java: InvalidKeySpecException

心已入冬 提交于 2019-12-11 06:08:20
问题 I created an ECDSA keypair and exported the public key using OpenSSL, but I'm unable to read the public key in from Java. Key generation in OpenSSL: $ openssl ecparam -name secp256k1 -genkey -noout -outform DER | openssl ec -inform DER -pubout -outform DER > secp256k1.public.der Clojure code that reads a key in from file, with [org.bouncycastle/bcprov-jdk15on "1.56"] as a dependency: (ns adhoc.ecdsa-mismatch (:import (java.nio.file Files Paths) (java.security Security KeyFactory) (java

Error incomplete definition of type 'struct ec_key_st' using OpenSSL

你。 提交于 2019-12-11 02:12:14
问题 I am trying to compute public key from given secret by openssl. I get this error: main.c:27: error: incomplete definition of type 'struct ec_key_st' printf("d: %s\n", BN_bn2hex(eckey->priv_key)); ~~~~~^ Here is my code: #include <stdio.h> #include <openssl/ec.h> #include <openssl/ecdsa.h> #include <openssl/bn.h> #include <openssl/obj_mac.h> int main() { BN_CTX *ctx = BN_CTX_new(); EC_KEY *eckey = EC_KEY_new(); EC_GROUP *group = EC_GROUP_new_by_curve_name(NID_secp256k1); EC_KEY_set_group(eckey

How to construct private key from generated previously ECDSA both encoded key pair?

杀马特。学长 韩版系。学妹 提交于 2019-12-10 21:17:15
问题 Having generated the private key like this: fun getKeyPair(): Pair<ByteArray, ByteArray> { Security.addProvider(provider) val generator = KeyPairGenerator.getInstance("ECDSA") val ecSpec = ECNamedCurveTable.getParameterSpec("secp256r1") generator.initialize(ecSpec) val keyPair = generator.generateKeyPair() val publicKey = keyPair.public as ECPublicKey val privateKey = keyPair.private return Pair(publicKey.q.getEncoded(true), privateKey.getEncoded()) } The public key can be reconstructed again

ECDSA Signature in Javacard

只谈情不闲聊 提交于 2019-12-10 17:53:11
问题 I'm implementing the signing code using ECDSA in Javacard. My code outputs 0x0003(NO_SUCH_ALGORITHM) in exception part which means this card does not support the algorithm. I don't understand that because my vendor told me that it supports ECC. I concluded I don't know how to sign with ECDSA and I want to know that. Here is my full source code package MyECDSA; import javacard.framework.*; import javacard.security.*; import javacardx.crypto.*; public class MyECDSA extends Applet{ private byte[

Creation of ECDSA private key given curve and private exponent?

心不动则不痛 提交于 2019-12-10 10:52:03
问题 I am new to cryptopp and have been struggling for a while with the creation of private keys for ECDSA signing. I have a hex encoded private exponent E4A6CFB431471CFCAE491FD566D19C87082CF9FA7722D7FA24B2B3F5669DBEFB . This is stored as a string. I want to use this to sign a text block using ECDSA. My code looks a bit like this string Sig::genSignature(const string& privKeyIn, const string& messageIn) { AutoSeededRandomPool prng; ECDSA<ECP, SHA256>::PrivateKey privateKey; privateKey