Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is there an example of ECDSA algorithm #42

Open
tiantianaixuexi opened this issue Aug 26, 2020 · 5 comments
Open

is there an example of ECDSA algorithm #42

tiantianaixuexi opened this issue Aug 26, 2020 · 5 comments
Labels
question Further information is requested

Comments

@tiantianaixuexi
Copy link

Hello, is there an example of ECDSA algorithm?

@AKushWarrior
Copy link
Contributor

There is not. What are you trying to do? I can try writing one for you.

@tiantianaixuexi
Copy link
Author

I want to load the private key and secret key from the file, and then encrypt and decrypt the transmitted data through ECDSA.

@AKushWarrior
Copy link
Contributor

I want to load the private key and secret key from the file, and then encrypt and decrypt the transmitted data through ECDSA.

I don't know of a way to encode/decode keys from a file. Is there a file format you are using that I can investigate?

@tiantianaixuexi
Copy link
Author

This public key and Private key are generated by me from the Go language, and its code is like this.Its format ends in .pem

`

privateKey, _ := ecdsa.GenerateKey(c, rand.Reader)
// SaveKey
// x509
x509PrivateKey, _ := x509.MarshalECPrivateKey(privateKey)

//pem
block := pem.Block{
	Type:"ecc private key",
	Bytes:x509PrivateKey,
}

//Save in file
privateFile, _ := os.Create(privatePath)
pem.Encode(privateFile,&block)

defer privateFile.Close()

////////////////////SavePublicKey//////////////////////
// x509
x509PublicKey, _ := x509.MarshalPKIXPublicKey(&privateKey.PublicKey)
//  pem
publicBlock := pem.Block{
	Type:"ecc public key",
	Bytes:x509PublicKey,
}

publicFile, _ := os.Create(publicPath)
defer publicFile.Close()

pem.Encode(publicFile,&publicBlock)

`

The following files are the private keys and keys after they are generated
key.zip

@redDwarf03
Copy link
Contributor

Hello @tiantianaixuexi, Is this request still valid?

@redDwarf03 redDwarf03 added the question Further information is requested label Mar 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants