ecdsa

How to generate 33-byte compressed NIST P-256 public key?

怎甘沉沦 提交于 2019-12-13 03:26:58
问题 I need to generate such public key and do the additional signing of the bytes (which will include this generated previously key) I need to construct bytes of: ASN.1 prefix + signature of (33-byte compressed NIST P-256 public key) The signature should be delivered from other defined private key The ECDSA specifications: ● Curve: NIST P-256 Otherwise known as secp256r1 and prime256v1 (openssl) ● Signature format ASN.1. The r and s values of the ECDSA signature must be positive integers, and DER

Creation of ECDSA public key given curve and public point?

孤者浪人 提交于 2019-12-12 09:58:33
问题 I am struggling with the creation of a ECDSA public key from a string representation of a public key i.e string devicePublicKey("86FB5EB3CA0507226BE7197058B9EC041D3A3758D9D9C91902ACA3391F4E58AEF13AFF63CC4EF68942B9B94904DC1B890EDBEABD16B992110624968E894E560E"); previously I found that I had to prefix this key with '04' so not sure if this is require this time? I am trying to generate it to use in verifying a signature string ecs04b2ExpSignature(

C# ecdsa signature - Which key specification can i choose?

只愿长相守 提交于 2019-12-12 08:59:33
问题 i need to generate a ECDSA signature on C# side, and after reading and verify the signature on android application using (obviously) the relative public key. Well, to get a ECDSA key pair in java (with bouncy castle provider), the code is like that kpg = KeyPairGenerator.getInstance("ECDSA", "BC"); ecSpec = new ECGenParameterSpec("secp224k1"); kpg.initialize(ecSpec, new SecureRandom()); The string "secp224k1" , is the curve name. And i can choose "secp224k1","secp224r1","secp256k1","secp256r1

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

戏子无情 提交于 2019-12-12 05:38:56
问题 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

Can I create a JCE ECPublicKey from a Q value from an openssh public key and ECParameterSpec

瘦欲@ 提交于 2019-12-12 05:36:38
问题 I'm reading openssh format elliptic curve public keys (RFC 5656, section 3.1) and would like to get from a BigInteger Q value to an ECPublicKey instance using JCE (rather than say BouncyCastle). I want to do this to verify JWT signatures. e.g. https://api.github.com/users/davidcarboni/keys: ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBK8hPtB72/sfYgNw1WTska2DNOJFx+QhUxuV6OLINSD2ty+6gxcM8yZrvMqWdMePGRb2cGh8L/0bGOk+64IQ/pM= It looks like I can use ECPublicKeySpec .

CNG provider, how to convert an EC key to BCRYPT_ECCKEY_BLOB structure?

吃可爱长大的小学妹 提交于 2019-12-12 04:46:59
问题 I am writing a CNG provider. Specifically, stuck on implementing NCryptExportKey API. I am trying to convert an EC key (for signing, ECDSA256) from a hardware key manager. The h/w keymanager provides key in ASN format. I referred to MSDN documentation, it's mentioned that public key X and Y values(of BCRYPT_ECCKEY_BLOB structure) are in big-endian format. But in another post on stackoverflow (Import a Public key from somewhere else to CngKey?), the Magic value also seems to be in big-endian

BAD_ACCESS (code=EXC_I386_GPFLT) when signing with ECDSA

馋奶兔 提交于 2019-12-12 02:58:24
问题 I am trying to use Crypto++ on iOS. I downloaded a prebuilt version of the library from Marek Kotewicz's GitHub. I am struggling hard to run this sample code from the Crypto++ wiki. ECDSA<ECP, CryptoPP::SHA256>::PrivateKey privateKey; ECDSA<ECP, CryptoPP::SHA256>::PublicKey publicKey; AutoSeededRandomPool prng, rrng; privateKey.Initialize(prng, CryptoPP::ASN1::secp256k1()); privateKey.MakePublicKey(publicKey); string signature; string message = "Do or do not. There is no try."; StringSource s

How to reconstruct 33-byte compressed NIST P-256 public key from 33 bytes?

十年热恋 提交于 2019-12-12 01:16:38
问题 Supposed that the 33 bytes encoded Public Key can be created like this: Security.addProvider(provider) val generator = KeyPairGenerator.getInstance("ECDSA") val ecSpec = ECNamedCurveTable.getParameterSpec("secp256r1") generator.initialize(ecSpec) val keyPair = generator.generateKeyPair() val privateKey = keyPair.private as ECPrivateKey val publicKey = keyPair.public as ECPublicKey val publicEncoded = publicKey.q.getEncoded(true) How can I reconstruct it again on the other side (when I am

C# - ecc-certificate requested with BouncyCastle seems to be invalid in .NET

Deadly 提交于 2019-12-11 17:52:43
问题 As it turned out in the comments to this SO-question the source of the problem lies elsewhere so I decided to ask a new question. I request a certificate from our PKI for a ecc keypair (curve is brainpoolP384r1). This is done via registration authority that does the proof of possession. After that I attach the private key to the issued certificate using some of the code in this helpful questions/answers: generate-certificate-using-ecdsa-in-c-sharp and translating-elliptic-curve-parameters-bc

Create ASN.1 from two big integers

别说谁变了你拦得住时间么 提交于 2019-12-11 15:16:55
问题 I have a java program using an HSM that with the native API gives me and R and S value of an ECDSA signature which is just the two Big Integers. I need to take those Integers and create ASN.1 encoding. Any idea on how I could do that? I do have BouncyCastle up and running but, I am not familiar with the options available to me. 回答1: A small example to illustrate: import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.DERSequence; import javax.xml.bind.DatatypeConverter; import