Comments (2)
Did a bit more reading and it looks like the b33_address
function i wrote is wrong, as the address needs to be derived from the public key, which isn't returned directly by DEST GENERATE
with the SAM API.
I've rewritten the function to what I believe is now the correct implementation, however I'm still unable to derive the address associated with the published encrypted leaseset 🤔
pub fn b33_address(tun_conf: TunnelConfig, require_secret: bool, client_auth: bool) -> Option<String> {
use crc::Crc;
let public_key_type = match tun_conf.sam_options.signature_type {
SignatureType::EdDsaSha512Ed25519 => 7,
SignatureType::RedDsaSha512Ed25519 => 11,
_ => return None,
};
// the private key returned from `DEST GENERATE`
let decoded_private_key = BASE64_I2P.decode(tun_conf.secret_key.as_bytes()).ok()?;
// the public key returned from `DEST GENERATE`
let decoded_destination = BASE64_I2P.decode(tun_conf.public_key.as_bytes()).ok()?;
let stripped_private_key = &decoded_private_key[decoded_destination.len()..];
let private_key = &stripped_private_key[0..32];
let public_key = if public_key_type == 7 {
let sk = ed25519_dalek::SecretKey::from_bytes(private_key).ok()?;
let pk: ed25519_dalek::PublicKey = (&sk).into();
pk.as_bytes().to_vec()
} else if public_key_type == 11 {
let mut pk: [u8; 32] = [0_u8; 32];
pk.copy_from_slice(private_key);
let sk = x25519_dalek::StaticSecret::from(pk);
let pk = x25519_dalek::PublicKey::from(&sk);
pk.as_bytes().to_vec()
} else {
unreachable!()
};
let mut data_vec = Vec::with_capacity(public_key.len() + 3);
data_vec.extend_from_slice(&[0, 0, 0]);
data_vec.extend_from_slice(&public_key[..]);
let summer: Crc<u32> = Crc::<u32>::new(&crc::CRC_32_CKSUM);
let chk_sum = summer.checksum(&data_vec[3..]);
if require_secret {
data_vec[0] = 0x02;
}
if client_auth {
data_vec[0] |= 0x04;
}
data_vec[1] = (public_key_type & 0xff) as u8;
data_vec[2] = (11 & 0xff) as u8;
data_vec[0] ^= chk_sum as u8;
data_vec[1] ^= (chk_sum >> 8) as u8;
data_vec[2] ^= (chk_sum >> 16) as u8;
Some(format!("{}.b32.i2p", BASE32_I2P.encode(&data_vec)))
}
from i2p.i2p.
base64 decode the full 'secret' string and save binary in privkeys.dat
run: java -jar /path/to/i2p.jar privatekeyfile privkeys.dat
compare what it gives you with your output
if it's different, check format at top of PrivateKeyFile.java to see where you went wrong.
from i2p.i2p.
Related Issues (20)
- Many sites not accessible with 2.3.0 docker image HOT 1
- slow
- miss click
- feature request auto download host list from jump sites HOT 2
- stack guard error
- org.apache.ant:ant Denial of Service (DoS) HOT 1
- multiable Hardcoded Secrets cve HOT 2
- 2 uses of risky/ broken cryptograhic alogrithm CVE HOT 3
- multiable SSRF server side request forgery CVE HOT 1
- 4 open redirects CVE HOT 2
- Inadequate Encryption Strength CVE multiables HOT 2
- multiable Use of Password Hash With Insufficient Computational Effort :CVE
- can i have perms to allow pull requests etc HOT 1
- Use of Hardcoded, Security-relevant Constants HOT 1
- Observable Timing Discrepancy (Timing Attack) HOT 2
- Use of Hardcoded Credentials HOT 1
- Improper Neutralization of CRLF Sequences in HTTP Headers HOT 1
- Improper Neutralization of CRLF Sequences in HTTP Headers number 2
- fresh install with split-config breaks the addressbook HOT 3
- https://deb.i2p2.de not responding HOT 5
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 i2p.i2p.