Commit 7e639bb4 authored by Marcus Pedersén's avatar Marcus Pedersén
Browse files

Changed library to comply with GPLv3+

parent c1217843
# Change Log
## [v1.1.0]
- Changed used library to comply with GPLv3+
- Configured for build of debian package
## [v1.0.0]
- Added options to choose hash function to to generate TOTP password,
Available hash functions: Sha1 (Deefault), Sha256, Sha512
......
......@@ -100,25 +100,6 @@ dependencies = [
"byte-tools 0.3.1",
]
[[package]]
name = "boringauth"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb7cdb7905570428c927ba0c36b6dc6c846bee1154a83a27628b5e390419779c"
dependencies = [
"base32",
"hex",
"rand",
"ring",
"time",
]
[[package]]
name = "bumpalo"
version = "3.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820"
[[package]]
name = "byte-tools"
version = "0.2.0"
......@@ -138,16 +119,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
[[package]]
name = "cc"
version = "1.0.60"
name = "cfg-if"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef611cc68ff783f18535d77ddd080185275713d852c4f5cbb6122c462a7a825c"
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
[[package]]
name = "cfg-if"
version = "0.1.10"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "constant_time_eq"
......@@ -177,10 +158,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8"
dependencies = [
"autocfg",
"cfg-if",
"cfg-if 0.1.10",
"lazy_static",
]
[[package]]
name = "crypto-mac"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab"
dependencies = [
"generic-array 0.14.4",
"subtle",
]
[[package]]
name = "data-encoding"
version = "2.3.0"
......@@ -276,24 +267,19 @@ version = "0.1.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc587bc0ec293155d5bfa6b9891ec18a1e330c234f896ea47fbada4cadbe47e6"
dependencies = [
"cfg-if",
"cfg-if 0.1.10",
"libc",
"wasi 0.9.0+wasi-snapshot-preview1",
"wasi",
]
[[package]]
name = "hex"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77"
[[package]]
name = "js-sys"
version = "0.3.45"
name = "hmac"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca059e81d9486668f12d455a4ea6daa600bd408134cd17e3d3fb5a32d1f016f8"
checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840"
dependencies = [
"wasm-bindgen",
"crypto-mac",
"digest 0.9.0",
]
[[package]]
......@@ -308,15 +294,6 @@ version = "0.2.77"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2f96b10ec2560088a8e76961b00d47107b3a625fecb76dedb29ee7ccbf98235"
[[package]]
name = "log"
version = "0.4.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b"
dependencies = [
"cfg-if",
]
[[package]]
name = "magic-crypt"
version = "3.1.5"
......@@ -346,12 +323,6 @@ dependencies = [
"opaque-debug 0.3.0",
]
[[package]]
name = "once_cell"
version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "260e51e7efe62b592207e9e13a68e43692a7a279171d6ba57abd208bf23645ad"
[[package]]
name = "opaque-debug"
version = "0.2.3"
......@@ -370,24 +341,6 @@ version = "0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c36fa947111f5c62a733b652544dd0016a43ce89619538a8ef92724a6f501a20"
[[package]]
name = "proc-macro2"
version = "1.0.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "36e28516df94f3dd551a587da5357459d9b36d945a7c37c3557928c1c2ff2a2c"
dependencies = [
"unicode-xid",
]
[[package]]
name = "quote"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37"
dependencies = [
"proc-macro2",
]
[[package]]
name = "rand"
version = "0.7.3"
......@@ -446,21 +399,6 @@ dependencies = [
"rust-argon2",
]
[[package]]
name = "ring"
version = "0.16.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "952cd6b98c85bbc30efa1ba5783b8abf12fec8b3287ffa52605b9432313e34e4"
dependencies = [
"cc",
"libc",
"once_cell",
"spin",
"untrusted",
"web-sys",
"winapi",
]
[[package]]
name = "rpassword"
version = "5.0.0"
......@@ -484,34 +422,36 @@ dependencies = [
]
[[package]]
name = "sha2"
version = "0.9.1"
name = "sha-1"
version = "0.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2933378ddfeda7ea26f48c555bdad8bb446bf8a3d17832dc83e380d444cfb8c1"
checksum = "ce3cdf1b5e620a498ee6f2a171885ac7e22f0e12089ec4b3d22b84921792507c"
dependencies = [
"block-buffer 0.9.0",
"cfg-if",
"cfg-if 1.0.0",
"cpuid-bool",
"digest 0.9.0",
"opaque-debug 0.3.0",
]
[[package]]
name = "spin"
version = "0.5.2"
name = "sha2"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
checksum = "2933378ddfeda7ea26f48c555bdad8bb446bf8a3d17832dc83e380d444cfb8c1"
dependencies = [
"block-buffer 0.9.0",
"cfg-if 0.1.10",
"cpuid-bool",
"digest 0.9.0",
"opaque-debug 0.3.0",
]
[[package]]
name = "syn"
version = "1.0.41"
name = "subtle"
version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6690e3e9f692504b941dc6c3b188fd28df054f7fb8469ab40680df52fdcc842b"
dependencies = [
"proc-macro2",
"quote",
"unicode-xid",
]
checksum = "343f3f510c2915908f155e94f17220b19ccfacf2a64a2a5d8004f2c3e311e7fd"
[[package]]
name = "tiger-digest"
......@@ -525,25 +465,27 @@ dependencies = [
]
[[package]]
name = "time"
version = "0.1.44"
name = "totp-rs"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255"
checksum = "71aa19b1e6a6bdf8c212498da1a8e54c50ec7c22da9862dea576910616d1137e"
dependencies = [
"libc",
"wasi 0.10.0+wasi-snapshot-preview1",
"winapi",
"base32",
"byteorder",
"hmac",
"sha-1",
"sha2",
]
[[package]]
name = "ttp"
version = "1.0.0"
version = "1.1.0"
dependencies = [
"boringauth",
"data-encoding",
"dirs",
"magic-crypt",
"rpassword",
"totp-rs",
"uuid",
]
......@@ -553,18 +495,6 @@ version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33"
[[package]]
name = "unicode-xid"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
[[package]]
name = "untrusted"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"
[[package]]
name = "uuid"
version = "0.8.1"
......@@ -586,76 +516,6 @@ version = "0.9.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
[[package]]
name = "wasi"
version = "0.10.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
[[package]]
name = "wasm-bindgen"
version = "0.2.68"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ac64ead5ea5f05873d7c12b545865ca2b8d28adfc50a49b84770a3a97265d42"
dependencies = [
"cfg-if",
"wasm-bindgen-macro",
]
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.68"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f22b422e2a757c35a73774860af8e112bff612ce6cb604224e8e47641a9e4f68"
dependencies = [
"bumpalo",
"lazy_static",
"log",
"proc-macro2",
"quote",
"syn",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.68"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b13312a745c08c469f0b292dd2fcd6411dba5f7160f593da6ef69b64e407038"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
]
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.68"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f249f06ef7ee334cc3b8ff031bfc11ec99d00f34d86da7498396dc1e3b1498fe"
dependencies = [
"proc-macro2",
"quote",
"syn",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.68"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d649a3145108d7d3fbcde896a468d1bd636791823c9921135218ad89be08307"
[[package]]
name = "web-sys"
version = "0.3.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4bf6ef87ad7ae8008e15a355ce696bed26012b7caa21605188cfd8214ab51e2d"
dependencies = [
"js-sys",
"wasm-bindgen",
]
[[package]]
name = "winapi"
version = "0.3.9"
......
[package]
name = "ttp"
version = "1.0.0"
version = "1.1.0"
authors = ["marcus <marcus.pedersen@slu.se>"]
edition = "2018"
license = "GPL-3.0-or-later"
......@@ -14,7 +14,7 @@ rpassword = "5.0.0"
dirs = "3.0"
magic-crypt = "3.1.5"
uuid = { version = "0.8", features = ["v4"] }
boringauth = "0.9.0"
totp-rs = "0.6.3"
data-encoding = "2.3.0"
......
ttp (1.1.0-1) unstable; urgency=LOW
* Changed used library to comply with GPLv3+
* Configured for build of debian package
-- Marcus Pedersén <marcus.pedersen@slu.se> Thu, 19 Nov 2020 13:58:00 +0100
ttp (1.0.0) unstable; urgency=LOW
* Added options to chose hash function to generate TOTP password,
......
No preview for this file type
......@@ -23,11 +23,13 @@ use std::io::prelude::*;
use std::io::BufReader;
use std::fs::File;
use std::fmt;
use std::time::SystemTime;
use rpassword;
use dirs;
use uuid::Uuid;
use magic_crypt::{ MagicCryptTrait, new_magic_crypt };
use boringauth::oath::{ TOTPBuilder, HashFunction };
use totp_rs::{Algorithm, TOTP};
//use boringauth::oath::{ TOTPBuilder, HashFunction };
use data_encoding::BASE32;
const VERSION: &str = env!("CARGO_PKG_VERSION");
......@@ -630,24 +632,48 @@ fn get_key(name: String) -> Result<(), String> {
if return_stat.is_ok() {
if hash == Hash::Sha1 {
match TOTPBuilder::new().base32_key(&base32).hash_function(HashFunction::Sha1).output_len(digits.into()).finalize() {
Ok(t) => println!("Password code: {}", t.generate()),
Err(e) => return_stat = Err(format!("Error generating TOTP password code for: {}, Error: {:?}", name, e)),
}
let totp = TOTP::new(
Algorithm::SHA1,
digits.into(),
1,
30,
BASE32.decode(base32.as_bytes()).unwrap(),
);
match SystemTime::now().duration_since(SystemTime::UNIX_EPOCH) {
Ok(t) => println!("Password code: {}", totp.generate(t.as_secs())),
Err(e) => return_stat = Err(format!("Error getting system time in epoch time: {}", e)),
}
}
if hash == Hash::Sha256 {
match TOTPBuilder::new().base32_key(&base32).hash_function(HashFunction::Sha256).output_len(digits.into()).finalize() {
Ok(t) => println!("Password code: {}", t.generate()),
Err(e) => return_stat = Err(format!("Error generating TOTP password code for: {}, Error: {:?}", name, e)),
}
let totp = TOTP::new(
Algorithm::SHA256,
digits.into(),
1,
30,
BASE32.decode(base32.as_bytes()).unwrap(),
);
match SystemTime::now().duration_since(SystemTime::UNIX_EPOCH) {
Ok(t) => println!("Password code: {}", totp.generate(t.as_secs())),
Err(e) => return_stat = Err(format!("Error getting system time in epoch time: {}", e)),
}
}
if hash == Hash::Sha512 {
match TOTPBuilder::new().base32_key(&base32).hash_function(HashFunction::Sha512).output_len(digits.into()).finalize() {
Ok(t) => println!("Password code: {}", t.generate()),
Err(e) => return_stat = Err(format!("Error generating TOTP password code for: {}, Error: {:?}", name, e)),
}
let totp = TOTP::new(
Algorithm::SHA512,
digits.into(),
1,
30,
BASE32.decode(base32.as_bytes()).unwrap(),
);
match SystemTime::now().duration_since(SystemTime::UNIX_EPOCH) {
Ok(t) => println!("Password code: {}", totp.generate(t.as_secs())),
Err(e) => return_stat = Err(format!("Error getting system time in epoch time: {}", e)),
}
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment