ecdsa

Verifying ECDSA signature with Bouncy Castle in C#

倾然丶 夕夏残阳落幕 提交于 2020-01-21 08:52:11
问题 I have a problem when I try to verify the ECDSA signature in Bouncy Castle in C#. The code is adopted from Java example that I have, so I am 100% sure that the public key and signature are correct. But the C# implementation always returns that the signature is not valid. I checked the curve parameters and they are correct. I tried with DER and "raw" signature and again it did not work. Can anybody spot what I am doing wrong: namespace TestECDSA { class Program { static void Main(string[] args

Different output while using openssl_sign() in PHP

倾然丶 夕夏残阳落幕 提交于 2020-01-17 07:20:13
问题 I recent tried to use PHP openssl extension with an ecdsa self signed certificate that i've issued using this tutorial create-a-self-signed-ecc-certificate. I have used function openssl_sign() as described in PHP manual. I've notice every time i refresh the web page , i got different signature output. Can anyone explain what happen? And is there any manner to get the same signature output every time with ecdsa certificate? 回答1: A component of generating an ECDSA signature is generating a

Convert ECDSA private hex key to public key

一曲冷凌霜 提交于 2020-01-15 04:52:48
问题 I'm using the below two lines to generate a hex of an ECDSA private key: openssl ecparam -genkey -name secp256k1 -out data.pem openssl ec -in data.pem -outform DER|tail -c +8|head -c 32|xxd -p -c 32 Those output something like this: 059f2c8f5b1978bcc02d4b41e75c3aae99f3194fb06b53ffd256178e1367a2a6 How can I then use that hex key to generate a public ECDSA key, something like this?

Convert ECDSA private hex key to public key

送分小仙女□ 提交于 2020-01-15 04:52:04
问题 I'm using the below two lines to generate a hex of an ECDSA private key: openssl ecparam -genkey -name secp256k1 -out data.pem openssl ec -in data.pem -outform DER|tail -c +8|head -c 32|xxd -p -c 32 Those output something like this: 059f2c8f5b1978bcc02d4b41e75c3aae99f3194fb06b53ffd256178e1367a2a6 How can I then use that hex key to generate a public ECDSA key, something like this?

Deriving ECDSA Public Key from Private Key

落花浮王杯 提交于 2020-01-11 03:37:25
问题 I was attempting to generate a public ECDSA key from a private key, and I haven't managed to find much help on the internet as to how to do this. Pretty much everything is for generating a public key from a public key spec, and I don't know how to get that. So far, this is what I've put together: public void setPublic() throws GeneralSecurityException { ECNamedCurveParameterSpec params = ECNamedCurveTable.getParameterSpec("secp256k1"); KeyFactory fact = KeyFactory.getInstance("ECDSA", "BC");

ECDSA signature length

天涯浪子 提交于 2020-01-10 00:28:06
问题 What will the signature length for 256 bit EC key in ECDSA algorithm? I wanted to validated signature length for the same. It will be great if some body can help me with one EC key set. 回答1: It depends on how you encode the signature. This is the code segment from OpenSSL that measures the length of ECDSA signature in DER format. /** ECDSA_size * returns the maximum length of the DER encoded signature * \param eckey pointer to a EC_KEY object * \return numbers of bytes required for the DER

Java ECC encoded Key too large

喜你入骨 提交于 2020-01-02 16:14:12
问题 I am new to the EC-encryption and have some struggle with it. I am using Java 8 and the BouncyCatle provider. The Question I have now is: when I generate an EC-KeyPair with the folloing code: ECGenParameterSpec spec = new ECGenParameterSpec("secp521r1"); KeyPairGenerator kpg = KeyPairGenerator.getInstance("ECDH", BouncyCastleProvider.PROVIDER_NAME); kpg.initialize(spec, new SecureRandom()); return kpg.generateKeyPair(); and try to get the byte array of the public key to send it to another

Java ECDSAwithSHA256 signature with inconsistent length

倖福魔咒の 提交于 2019-12-31 05:31:26
问题 So I am trying to generate an ECDSAwithHA256 signature in Java, and for that, I am using the BouncyCastle provider. The curve is a secp521r1. To initalize the signer I am using: public static final String SIGNATURE_ALGORITHEM = "SHA256withECDSA"; public void init() { signer = Signature.getInstance(SIGNATURE_ALGORITHEM, BouncyCastleProvider.PROVIDER_NAME); signer.initSign(privKey); } And to sign I am using public byte[] sign(byte[] bytes) throws SignatureException { signer.update(bytes); byte[

How can I generate a valid ECDSA EC key pair?

半世苍凉 提交于 2019-12-31 02:45:29
问题 I am trying to generate ECDSA key pair using SpongyCastle in Android. This is the code: static { Security.insertProviderAt(new org.spongycastle.jce.provider.BouncyCastleProvider(), 1); } public static KeyPair generate() { ECParameterSpec ecSpec = ECNamedCurveTable.getParameterSpec("prime256v1"); KeyPairGenerator generator = KeyPairGenerator.getInstance("ECDSA", "SC"); generator.initialize(ecSpec, new SecureRandom()); KeyPair keyPair = g.generateKeyPair(); Log.i(TAG, "EC Pub Key generated: " +

Translating Elliptic Curve parameters (BC to MS)

限于喜欢 提交于 2019-12-29 01:28:31
问题 I'm trying to generate ECDSA self-signed certificate as described in generate certificate using ECDSA. Putting all pieces from bartonjs's answer together and using Net.Framework 4.7 (or Net.Core 2.0 ) following code seems to be working although there are some ambiguities (at least one) left: I'm not sure how to properly convert private key ('D' parameter) from BC-BigInteger to MS-byte[] . Using BigInteger.ToByteArray() throws exception: CryptographicException : The specified key parameters