Created
March 12, 2023 00:05
-
-
Save ulerdogan/af14421517d535647f908c5849973f31 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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