rust-ipfs/http/build.rs
Joonas Koivunen 47b9d02a2a feat: rsa keygen using openssl with compat storage
taking on the openssl dependency is used for:

 - rsa key generation
 - from/to `pkcs#1` and `pkcs#8` transformations

Crate `rsa` was also considered but it does not support exporting keys
in any format at the moment and it's import code looks different from
`ring`s (this could be the case of not importing the "precomputed"
values in `rsa`).

The `pkcs#1` is (hopefully) used with go-ipfs-config/go-libp2p
compatible key storage but rust-libp2p/ring need the key in `pkcs#8` der
format. PEM parsing and PEM to DER was implemented by hand as it looked
like the existingly depended on crates are not compatible as much as
possible.
2020-03-12 16:30:36 +02:00

12 lines
548 B
Rust

fn main() {
// vergen will generate build flags which will allow direct usage of env!(...) macro to find
// VERGEN_SHA_SHORT and others: https://docs.rs/vergen/3.0.4/vergen/
//
// the rebuild on each commit can be turned off:
// https://docs.rs/vergen/3.0.4/vergen/struct.ConstantsFlags.html#associatedconstant.REBUILD_ON_HEAD_CHANGE
vergen::generate_cargo_keys(vergen::ConstantsFlags::all())
.expect("Unable to generate the cargo keys!");
prost_build::compile_protos(&["src/keys.proto"], &["src"]).unwrap();
}