1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#[macro_use]
extern crate json;

mod pki;

///This function returns a json string that contains public key, private key , Base64 encoded public key and Concrete ID



/// # Examples
///
/// //import the nxmpki crate  --> extern crate nxmpki;
///
/// //import rustc_serialize  -->extern crate rustc_serialize;
///
/// // use the Json from rustc_serialize --> use rustc_serialize::json::Json;
///
/// //Inside the function:
///
///     let mut json_str=nxmpki::get_nxm_pki().to_string();
///
///     json_str = json_str.to_string();
///
///     let json = Json::from_str(&json_str).unwrap();
///
///     let js = json.find_path(&["cid"]).unwrap();
///
///     let pub_k=json.find_path(&["public_key"]).unwrap();
///
///     println!("cid :{}, public key : {}", js, pub_k);



pub fn get_nxm_pki() -> String{

    let pki_data = pki::pki::create_pki();
    return pki_data;

}