Comments (2)
While generating onion url you have to provide the private key. If you preserve the onion address by supplying same key.
Here _key is your key in string format.
key, err := ParseRsaPrivateKeyFromPemStr(_key)
onion, err = t.Listen(ctx, &tor.ListenConf{RemotePorts: []int{80}, LocalPort: goServerPort, Key: key})
For generating private key and storing it as string for later reference.
func GenerateKey() string {
key, err := rsa.GenerateKey(rand.Reader, 1024)
if err != nil {
return err.Error()
}
return ExportRsaPrivateKeyAsPemStr(key)
}
func ExportRsaPrivateKeyAsPemStr(privkey *rsa.PrivateKey) string {
privkey_bytes := x509.MarshalPKCS1PrivateKey(privkey)
privkey_pem := pem.EncodeToMemory(
&pem.Block{
Type: "RSA PRIVATE KEY",
Bytes: privkey_bytes,
},
)
return string(privkey_pem)
}
func ParseRsaPrivateKeyFromPemStr(privPEM string) (*rsa.PrivateKey, error) {
block, _ := pem.Decode([]byte(privPEM))
if block == nil {
return nil, errors.New("failed to parse PEM block containing the key")
}
priv, err := x509.ParsePKCS1PrivateKey(block.Bytes)
if err != nil {
return nil, err
}
return priv, nil
}
from go-libtor.
after trying to write a tor V3 address to the _key variable, i was having some issues
_key = "== ed25519v1-secret: "....
it returns: "panic: runtime error: invalid memory address or nil pointer dereference"
then it segfaults.
is there a similar function to ParseRsaPrivateKeyFromPemStr but for V3 addresses? i couldn't find anything in the documentation
from go-libtor.
Related Issues (20)
- Onion ID length HOT 1
- Restart Tor HOT 4
- Use 0.4.x Tor
- Can't run concurrent tor instances. HOT 2
- Example program (main.go) won't run HOT 1
- No way to define ev_uint64_t HOT 2
- v3 onion addresses HOT 2
- Out of Date Documentation/Bine Creator Usage HOT 1
- The filename or extension is too long. HOT 2
- error main.go:12:2: found packages libtor (libtor.go) and main (main.go) in /home/user/repos/go-libtor
- Version 2 Onion Sites will be deprecated soon
- Upstream iOS and macOS support from berty/go-libtor
- Warning when running in docker HOT 2
- go get failed
- VFS idea
- How is it possible to persist V3 .onion address? HOT 3
- Error after running go get HOT 2
- 1st signal interrupt is caught by the Tor process, and ignored by the go process HOT 1
- Error when build HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-libtor.