ecdsa

How to store ECDSA private key in Go

不羁岁月 提交于 2019-12-03 01:54:30
I am using the ecdsa.GenerateKey method to generate a private/public key pair in Go. I would like to store the private key in a file on the users computer, and load it whenever the program starts. There is a method elliptic.Marshal that marshals the public key, but nothing for the private key. Should I simply roll my own, or is there a recommended way to store the private key? Here is a code sample that demonstrates encoding and decoding of keys in Go. It helps to know that you need to connect couple of steps. Crypto algorithm is the fist step, in this case ECDSA key. Then you need standard

Get ECDSA signature with Crypto++

限于喜欢 提交于 2019-12-02 18:18:53
问题 I have to get ECDSA signature in variable using Crypto++. I tried to get it after launching SignMessage but signature is empty. How could i get it? 回答1: Have you had a look at the Crypto++ wiki? There's a lot of stuff on Elliptic Curve Digital Signature Algorithm. Its not really clear what you are doing or where things went wrong, so here's a copy and paste from the wiki: Signing: ECDSA<ECP, SHA1>::PrivateKey privateKey; privateKey.Load(...); AutoSeededRandomPool prng; string message = "Yoda

Does OpenSSL -sign for ECDSA apply ASN1 encoding to the hash before signing?

十年热恋 提交于 2019-12-02 12:07:13
This SO question ECDSA sign using OpenSSL without ASN1 encoding the hash states the OpenSSL perfoms ASN1 encoding to the hash before signing it. In other words it states that OpenSSL performs the following steps when for an Elliptic curve key -sign is called: a. Calculate H = Hash(M) b. Encode H into ASN1 standard- H’ c. Sign H’ And thus to avoid applyting step b it's neccessary to first calculate the digest, and then sign the digest using raw signing - pkeyutl for elliptic curver keys However when I run BOTH -sign and -dgst+ -pkeyutl I am able to verify the signature using -verify in both

Get ECDSA signature with Crypto++

守給你的承諾、 提交于 2019-12-02 10:19:18
I have to get ECDSA signature in variable using Crypto++. I tried to get it after launching SignMessage but signature is empty. How could i get it? Have you had a look at the Crypto++ wiki? There's a lot of stuff on Elliptic Curve Digital Signature Algorithm . Its not really clear what you are doing or where things went wrong, so here's a copy and paste from the wiki: Signing: ECDSA<ECP, SHA1>::PrivateKey privateKey; privateKey.Load(...); AutoSeededRandomPool prng; string message = "Yoda said, Do or do not. There is no try."; string signature; StringSource ss1( message, true /*pump all*/, new

How to create ECDSA keypair (256bit) for bitcoin curve (secp256k1) using spongy castle?

两盒软妹~` 提交于 2019-12-01 17:38:41
Currently, I am creating keyPair using this method private KeyPair getKeyPair() throws NoSuchAlgorithmException, NoSuchProviderException, InvalidAlgorithmParameterException { KeyPairGenerator keyGen = KeyPairGenerator.getInstance("ECDsA", "SC"); ECGenParameterSpec ecSpec = new ECGenParameterSpec("secp256k1"); keyGen.initialize(ecSpec, new SecureRandom()); return keyGen.generateKeyPair(); } KeyPairGenerator has another method, in which I can specify keySize but I am not sure how I will pass the keySpecs? public void initialize(int keysize, SecureRandom random) Your code is already sufficient,

Generating ECDSA signature with Node.js/crypto

ぃ、小莉子 提交于 2019-12-01 01:27:57
问题 I have code that generates a concatenated (r-s) signature for the ECDSA signature using jsrsasign and a key in JWK format: const sig = new Signature({ alg: 'SHA256withECDSA' }); sig.init(KEYUTIL.getKey(key)); sig.updateHex(dataBuffer.toString('hex')); const asn1hexSig = sig.sign(); const concatSig = ECDSA.asn1SigToConcatSig(asn1hexSig); return new Buffer(concatSig, 'hex'); Seems to work. I also have code that uses SubtleCrypto to achieve the same thing: importEcdsaKey(key, 'sign') //

Error when verifying ECDSA signature in Java with BouncyCastle

折月煮酒 提交于 2019-11-30 14:58:56
问题 I have tested a solution to verify an ECDSA signature (How can I get a PublicKey object from EC public key bytes?) that works perfect with the given data. This is the data: byte[] pubKey = DatatypeConverter.parseHexBinary("049a55ad1e210cd113457ccd3465b930c9e7ade5e760ef64b63142dad43a308ed08e2d85632e8ff0322d3c7fda14409eafdc4c5b8ee0882fe885c92e3789c36a7a"); byte[] message = DatatypeConverter.parseHexBinary(

Error when verifying ECDSA signature in Java with BouncyCastle

允我心安 提交于 2019-11-30 13:41:48
I have tested a solution to verify an ECDSA signature ( How can I get a PublicKey object from EC public key bytes? ) that works perfect with the given data. This is the data: byte[] pubKey = DatatypeConverter.parseHexBinary("049a55ad1e210cd113457ccd3465b930c9e7ade5e760ef64b63142dad43a308ed08e2d85632e8ff0322d3c7fda14409eafdc4c5b8ee0882fe885c92e3789c36a7a"); byte[] message = DatatypeConverter.parseHexBinary("54686973206973206a75737420736f6d6520706f696e746c6573732064756d6d7920737472696e672e205468616e6b7320616e7977617920666f722074616b696e67207468652074696d6520746f206465636f6465206974203b2d29");

Importing ECC-based certificate from the Windows Certificate Store into CngKey

坚强是说给别人听的谎言 提交于 2019-11-30 08:57:48
问题 How can I get the public/private keys from an ECC-based X509Certificate2 's into CngKey 's for use with ECDsaCng and ECDiffieHellmanCng ? I'm currently using RSA 2048 bit key pairs to sign/encrypt stuff. I'm doing this by pulling the certificates from the X509Store where they are securely stored with private keys marked as non-exportable. I would like to convert the current implementation to use ECDSA and ECDH so that I can use smaller key sizes for equivalent security. I've successfully

SSH fingerprint verification for Amazon AWS EC2 server with ECDSA?

情到浓时终转凉″ 提交于 2019-11-29 22:56:36
When I create a new Amazon EC2 server, I connect to it using ssh as usual. I see the typical warning: $ ssh myserver The authenticity of host 'ec2-12-34-567-890.compute-1.amazonaws.com (12.34.567.890)' can't be established. ECDSA key fingerprint is 31:66:15:d2:19:41:2b:09:8a:8f:9f:bd:de:c6:ff:07. Are you sure you want to continue connecting (yes/no)? How do I verify the fingerprint before I sign in? Ideally an answer is based on something besides the original creation console log -- because the log may get flushed out after a system restart, or during a large system installation script that