aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2018-11-06 01:14:30 +0100
committerTeddy Wing2018-11-06 01:14:30 +0100
commit679c76ccb3273ea41499906f2b8c7908d24b7507 (patch)
tree9ece427e44e1721d96d29855427455910e145862
parent01bfe227cc257abd0d98d727d22efb5b7ccef0b8 (diff)
downloaddome-key-web-679c76ccb3273ea41499906f2b8c7908d24b7507.tar.bz2
aquatic-prime: Strip `0x` from public & private keys
Learned from: https://github.com/bdrister/AquaticPrime/blob/57c6f70/Source/Cocoa/AquaticPrime.m#L111-L114 that the "0x" prefix on the hex keys needs to be removed before using the RSA library functions on it. Otherwise it doesn't work. Couldn't figure that out from the other implementations because they use custom conversion functions instead of OpenSSL's functions. Previously, calling `BigNum::from_hex_str()` on the strings would yield `0`, but now we get proper BigNums.
-rw-r--r--license-generator/aquatic-prime/src/lib.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/license-generator/aquatic-prime/src/lib.rs b/license-generator/aquatic-prime/src/lib.rs
index 80db363..15c4aea 100644
--- a/license-generator/aquatic-prime/src/lib.rs
+++ b/license-generator/aquatic-prime/src/lib.rs
@@ -28,8 +28,8 @@ impl<'a> AquaticPrime<'a> {
.collect::<Vec<&str>>()
.concat();
- let public_key = BigNum::from_hex_str(self.public_key).unwrap();
- let private_key = BigNum::from_hex_str(self.private_key).unwrap();
+ let public_key = BigNum::from_hex_str(self.public_key.get(2..).unwrap()).unwrap();
+ let private_key = BigNum::from_hex_str(self.private_key.get(2..).unwrap()).unwrap();
let rsa_e = BigNum::from_u32(3).unwrap();
if public_key.num_bits() != 1024 {