ecdsa

ECDSA signature Java vs Go

♀尐吖头ヾ 提交于 2019-12-10 10:46:34
问题 I am trying to learn some Go and blockchains.. Starting with ECDSA signatures. Trying to figure out how to test if I had a correctly working Go implementation of ECDSA signatures, I figured I would try to create a similar version in Java and compare the results to see if I can get them to match. So Java attempt: public static void main(String[] args) throws Exception { //the keys below are previously generated with "generateKey();" and base64 encoded generateKey(); String privStr =

Microsoft CNG | How to import PEM encoded ECDSA private key into MS Key Storage Provider

℡╲_俬逩灬. 提交于 2019-12-09 21:36:24
问题 I know the MS CNG private have this format - BCRYPT_ECCKEY_BLOB BYTE X[cbKey] // Big-endian. BYTE Y[cbKey] // Big-endian. BYTE d[cbKey] // Big-endian. Thus tried to import below key bytes - byte[] ec256PrivKB = { //Magic + CBLength 0x45, 0x43, 0x53, 0x31, 0x20, 0x00, 0x00, 0x00, //X 0xA7, 0xFB, 0xCD, 0x4D, 0x7E, 0x43, 0x6F, 0x22, 0xBD, 0x74, 0xFA, 0x1F, 0xD7, 0x10, 0xDB, 0x8C, 0xF8, 0x29, 0xC1, 0xEC, 0x5E, 0x15, 0x1E, 0xE2, 0x84, 0x56, 0x3E, 0x54, 0x6E, 0x1D, 0x5C, 0xF6, //Y 0x6B, 0x42, 0x21,

ES256 JWT Signing in PHP for Apple AppStoreConenct API Auth

∥☆過路亽.° 提交于 2019-12-08 04:34:17
问题 I'm trying to authenticate to Apple's AppStoreConnect API with an ES256 signed JWT (per their instructions at https://developer.apple.com/documentation/appstoreconnectapi) using PHP. Sending my request always results in a 401 NOT_AUTHORIZED error. I've verified that the the contents of my header and claims are correct - I even found a Ruby script online for generating an ES256 signed JWT and using my Apple provided Issuer, Key ID, Private Key, it works swimmingly - Apple accepts the token.

(1)Convert the ECDSA private & public key, (2)Verification by ECDSA

浪子不回头ぞ 提交于 2019-12-07 19:10:29
问题 Following this discussion it's a simple tutorial how to sign a string by using ECDSA algorithm in java without using any third-party libraries. But the question is: How can i convert the public and the private key into a string ? (Because i want to send them into a database). Can somebody help me create a simple tutorial of how to verify the message by using ECDSA algorithm in java ? at this point i need to include the signature and public key as the verification method. Here's my scenario in

Generating a ECDSA Private key in bouncy castle returns a PUBLIC key

纵饮孤独 提交于 2019-12-07 15:03:48
问题 I am attempting to use bouncy castle to generate ECDSA keys. The code seems to work fine from the Java perspective; but, when I dump the file and try to validate the data, OpenSSL does not like the format of the data. After some research, I figured that bouncy castle is encoding the private key as public key. Here is my Java code: public class Test { public static void main(String[] args) { Security.addProvider(new BouncyCastleProvider()); System.out.println("Starting..."); String name =

Fixed length 64 Bytes EC P-256 Signature with JCE

◇◆丶佛笑我妖孽 提交于 2019-12-07 06:35:00
问题 I need a fixed length 64 Byte ECDSA signature with the NIST P-256 Curve. The implementation hast to use JCE. The following code sample can generate a signature and verify it. Provider provSign = new SunEC(); Provider provVerify = new SunEC(); // generate EC key KeyPairGenerator kg = KeyPairGenerator.getInstance("EC", provSign); ECGenParameterSpec ecParam = new ECGenParameterSpec("secp256r1"); kg.initialize(ecParam); KeyPair keyPair = kg.generateKeyPair(); PrivateKey privateKey = keyPair

Deriving an ECDSA uncompressed public key from a compressed one

橙三吉。 提交于 2019-12-06 22:32:38
问题 I am currently trying to derive a Bitcoin uncompressed ECDSA public key from a compressed one. According to this link on the Bitcoin wiki, it is possible to do so... But how? To give you more details: as of now I have compressed keys (33-bytes-long) gathered on the bitcoin network. They are of the following format: <1-byte-long prefix><32-bytes-long X>. From there, I would like to obtain an uncompressed key (65-bytes-long) whose format is: <1-byte-long prefix><32-bytes-long X><32-bytes-long Y

Creation of ECDSA private key given curve and private exponent?

▼魔方 西西 提交于 2019-12-06 07:54:35
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.AccessGroupParameters().Initialize(ASN1::secp256r1()); privateKey.Load(StringSource(privKeyIn, true, NULL).Ref());

ECDSA signature Java vs Go

风流意气都作罢 提交于 2019-12-06 07:24:31
I am trying to learn some Go and blockchains.. Starting with ECDSA signatures. Trying to figure out how to test if I had a correctly working Go implementation of ECDSA signatures, I figured I would try to create a similar version in Java and compare the results to see if I can get them to match. So Java attempt: public static void main(String[] args) throws Exception { //the keys below are previously generated with "generateKey();" and base64 encoded generateKey(); String privStr = "MEECAQAwEwYHKoZIzj0CAQYIKoZIzj0DAQcEJzAlAgEBBCAQ7bMVIcWr9NpSD3hPkns5C0qET87UvyY5WI6UML2p0Q=="; String pubStr =

Verifying ECDSA signature with Bouncy Castle in C#

不羁的心 提交于 2019-12-06 05:08:59
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) { byte[] b = new byte[] { 0x2B, 0xA1, 0x41, 0x00 }; string pubKey =