Skip to main content
Bumped by Community user
Bumped by Community user
Notice removed Canonical answer required by CommunityBot
Bounty Ended with no winning answer by CommunityBot
Notice added Canonical answer required by scob_
Bounty Started worth 50 reputation by scob_
added 141 characters in body; edited title
Source Link
scob_
  • 71
  • 5

Convert Put Ed25519 keys toin usable file format for Tor

I'm making an onion (v3) address generator in Python. Here is the part that generates the keypair:

from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives.asymmetric import x25519

def v3KeyGen():
    private_key = x25519.X25519PrivateKey.generate()
    private_bytes = private_key.private_bytes(encoding=serialization.Encoding.Raw, format=serialization.PrivateFormat.Raw, encryption_algorithm=serialization.NoEncryption())

    public_key = private_key.public_key()
    public_bytes = public_key.public_bytes(encoding=serialization.Encoding.Raw, format=serialization.PublicFormat.Raw)

    return public_bytes, private_bytes

What file format do I put the keys in (e.g. the format of the hs_ed25519_secret_key file), to get them to actually work with something like a Tor hidden service? Right now I have these keys, but have no idea how I actually get Tor to use them.

Edit: This is what an example private key file generated by Tor itself looks like, with some sort of binary data, I have no idea how to interpret it:

enter image description here

Convert Ed25519 keys to usable format for Tor

I'm making an onion (v3) address generator in Python. Here is the part that generates the keypair:

from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives.asymmetric import x25519

def v3KeyGen():
    private_key = x25519.X25519PrivateKey.generate()
    private_bytes = private_key.private_bytes(encoding=serialization.Encoding.Raw, format=serialization.PrivateFormat.Raw, encryption_algorithm=serialization.NoEncryption())

    public_key = private_key.public_key()
    public_bytes = public_key.public_bytes(encoding=serialization.Encoding.Raw, format=serialization.PublicFormat.Raw)

    return public_bytes, private_bytes

What format do I put the keys in, to get them to actually work with something like a Tor hidden service?

Edit: This is what an example private key file generated by Tor itself looks like, with some sort of binary data, I have no idea how to interpret it:

enter image description here

Put Ed25519 keys in usable file format for Tor

I'm making an onion (v3) address generator in Python. Here is the part that generates the keypair:

from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives.asymmetric import x25519

def v3KeyGen():
    private_key = x25519.X25519PrivateKey.generate()
    private_bytes = private_key.private_bytes(encoding=serialization.Encoding.Raw, format=serialization.PrivateFormat.Raw, encryption_algorithm=serialization.NoEncryption())

    public_key = private_key.public_key()
    public_bytes = public_key.public_bytes(encoding=serialization.Encoding.Raw, format=serialization.PublicFormat.Raw)

    return public_bytes, private_bytes

What file format do I put the keys in (e.g. the format of the hs_ed25519_secret_key file), to get them to actually work with something like a Tor hidden service? Right now I have these keys, but have no idea how I actually get Tor to use them.

Edit: This is what an example private key file generated by Tor itself looks like, with some sort of binary data, I have no idea how to interpret it:

enter image description here

Source Link
scob_
  • 71
  • 5

Convert Ed25519 keys to usable format for Tor

I'm making an onion (v3) address generator in Python. Here is the part that generates the keypair:

from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives.asymmetric import x25519

def v3KeyGen():
    private_key = x25519.X25519PrivateKey.generate()
    private_bytes = private_key.private_bytes(encoding=serialization.Encoding.Raw, format=serialization.PrivateFormat.Raw, encryption_algorithm=serialization.NoEncryption())

    public_key = private_key.public_key()
    public_bytes = public_key.public_bytes(encoding=serialization.Encoding.Raw, format=serialization.PublicFormat.Raw)

    return public_bytes, private_bytes

What format do I put the keys in, to get them to actually work with something like a Tor hidden service?

Edit: This is what an example private key file generated by Tor itself looks like, with some sort of binary data, I have no idea how to interpret it:

enter image description here