Open tiantianaixuexi opened 4 years ago
There is not. What are you trying to do? I can try writing one for you.
I want to load the private key and secret key from the file, and then encrypt and decrypt the transmitted data through ECDSA.
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?
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
Hello @tiantianaixuexi, Is this request still valid?
Hello, is there an example of ECDSA algorithm?