[Resolved] CentOS 7.6 rust build failed
tjyang opened this issue · comments
- Compilation error
[pi@centos7 rust]$ git remote -v
origin git@github.com:tjyang/bitwarden-cli.git (fetch)
origin git@github.com:tjyang/bitwarden-cli.git (push)
[pi@centos7 rust]$ pwd
/home/pi/github/bitwarden-cli/rust
[pi@centos7 rust]$ cargo build
Compiling bitwarden v0.1.0 (/home/pi/github/bitwarden-cli/rust)
error[E0433]: failed to resolve: use of undeclared type or module `hmac`
--> src/crypto.rs:114:21
|
114 | let mut hmac1 = hmac::Hmac::new(crypto::sha2::Sha256::new(), &mac_key);
| ^^^^ use of undeclared type or module `hmac`
error[E0433]: failed to resolve: use of undeclared type or module `hmac`
--> src/crypto.rs:116:21
|
116 | let mut hmac2 = hmac::Hmac::new(crypto::sha2::Sha256::new(), &mac_key);
| ^^^^ use of undeclared type or module `hmac`
error[E0425]: cannot find function `encrypt_aes_256_cbc` in this scope
--> src/crypto.rs:106:18
|
106 | let cipher = encrypt_aes_256_cbc(&symmetric_key, &master_key, &iv).unwrap();
| ^^^^^^^^^^^^^^^^^^^ not found in this scope
error[E0599]: no method named `from_base64` found for type `&str` in the current scope
--> src/crypto.rs:80:25
|
80 | mac = pieces[2].from_base64().unwrap();
| ^^^^^^^^^^^
|
= help: items from traits can only be used if the trait is in scope
= note: the following trait is implemented but not in scope, perhaps add a `use` for it:
`use serialize::base64::FromBase64;`
error[E0599]: no method named `from_base64` found for type `&str` in the current scope
--> src/crypto.rs:86:16
|
86 | iv: iv.from_base64().unwrap(),
| ^^^^^^^^^^^
|
= help: items from traits can only be used if the trait is in scope
= note: the following trait is implemented but not in scope, perhaps add a `use` for it:
`use serialize::base64::FromBase64;`
error[E0599]: no method named `from_base64` found for type `&str` in the current scope
--> src/crypto.rs:87:16
|
87 | ct: ct.from_base64().unwrap(),
| ^^^^^^^^^^^
|
= help: items from traits can only be used if the trait is in scope
= note: the following trait is implemented but not in scope, perhaps add a `use` for it:
`use serialize::base64::FromBase64;`
error[E0369]: binary operation `+` cannot be applied to type `std::vec::Vec<u8>`
--> src/crypto.rs:99:12
|
99 | return encryption_key + mac_key;
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: an implementation of `std::ops::Add` might be missing for `std::vec::Vec<u8>`
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
--> src/crypto.rs:106:9
|
106 | let cipher = encrypt_aes_256_cbc(&symmetric_key, &master_key, &iv).unwrap();
| ^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `[u8]`
= note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamicas-and-the-sized-trait>
= note: all local variables must have a statically known size
= help: unsized locals are gated as an unstable feature
error: aborting due to 8 previous errors
Some errors occurred: E0277, E0369, E0425, E0433, E0599.
For more information about an error, try `rustc --explain E0277`.
error: Could not compile `bitwarden`.
To learn more, run the command again with --verbose.
- CentOS 7.6 and rust 1.32
[pi@centos7 rust]$ cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
[pi@centos7 rust]$ rustc --version
rustc 1.32.0 (9fda7c223 2019-01-16)
[pi@centos7 rust]$
Send pull requests :) I haven't had much time to work on this in a while and probably won't get back to it for a while either. The rust code isn't production ready by any means. The python code works for me, but the rust stuff is not in a stable working state yet. It's very much a WIP. The rust server that holds the decryption key in memory worked for me once, but I haven't gotten around to testing it much beyond that.
So if you want the rust version to work... Send pull requests or be very patient.
Thanks for the current rust code. I will try ;)
- thanks for the good work on BW client for rust. I now have working src to learn from rust programming from your code.
[pi@centos7 release]$ ./bitwarden --help
Bitwarden CLI 0.1.0
Birl.org
USAGE:
bitwarden [OPTIONS] [SUBCOMMAND]
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
-u <url> URL of bitwarden server [default: http://127.0.0.1:8000]
SUBCOMMANDS:
help Prints this message or the help of the given subcommand(s)
login login to bitwarden
register register new account with bitwarden server.
sync sync against remote bitwarden server
[pi@centos7 release]$ pwd
/home/pi/github/bitwarden-cli/rust/target/release
[pi@centos7 release]$ git remote -v
origin git@github.com:tjyang/bitwarden-cli.git (fetch)
origin git@github.com:tjyang/bitwarden-cli.git (push)
[pi@centos7 release]$ date
Fri Feb 15 18:12:52 EST 2019
[pi@centos7 release]$
Awesome! send the code?! :)
no rust code, still trying to understand your good rust code. What I did was st some crates adjusting in cargo.toml to finish crago build. I will re-fork and generate cleaner pull request.