mirror of
https://github.com/asmogo/nws.git
synced 2024-12-13 02:46:22 +00:00
18 lines
383 B
Go
18 lines
383 B
Go
|
package protocol
|
||
|
|
||
|
import (
|
||
|
"encoding/hex"
|
||
|
)
|
||
|
|
||
|
func GetEncryptionKeys(privateKey, publicKey string) ([]byte, []byte, error) {
|
||
|
targetPublicKeyBytes, err := hex.DecodeString("02" + publicKey)
|
||
|
if err != nil {
|
||
|
return nil, nil, err
|
||
|
}
|
||
|
privateKeyBytes, err := hex.DecodeString(privateKey)
|
||
|
if err != nil {
|
||
|
return nil, nil, err
|
||
|
}
|
||
|
return privateKeyBytes, targetPublicKeyBytes, nil
|
||
|
}
|