Skip to content

Instantly share code, notes, and snippets.

@ulerdogan
Created March 12, 2023 00:05
Show Gist options
  • Save ulerdogan/af14421517d535647f908c5849973f31 to your computer and use it in GitHub Desktop.
Save ulerdogan/af14421517d535647f908c5849973f31 to your computer and use it in GitHub Desktop.
import (
"crypto/ecdsa"
"encoding/hex"
)
func getPublicKey(publicKeyHex string) (*ecdsa.PublicKey, error) {
publicKeyBytes, err := hex.DecodeString(publicKeyHex)
if err != nil {
return nil, err
}
publicKey := &ecdsa.PublicKey{}
publicKey.Curve = ecdsa.NamedCurveP256() // veya farklı bir eğriyi seçebilirsiniz
publicKey.X = new(big.Int).SetBytes(publicKeyBytes[:32])
publicKey.Y = new(big.Int).SetBytes(publicKeyBytes[32:])
return publicKey, nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment