-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
where to add certificates and password #97
Comments
Hi, You can use rusttls-pemfile to easily load the client certificate chain and key in The username and password should be added when you construct and send a login request using the use std::net::ToSocketAddrs;
use std::time::Duration;
use std::fs::File;
use std::io::BufReader;
use epp_client::EppClient;
use epp_client::domain::DomainCheck;
use epp_client::login::Login;
use epp_client::common::Certificate;
use epp_client::common::PrivateKey;
#[tokio::main]
async fn main() {
let host = "epp-ote.verisign-grs.com";
let addr = (host, 700).to_socket_addrs().unwrap().next().unwrap();
let timeout = Duration::from_secs(5);
let file = File::open("/path/to/certs/fullchain.pem").unwrap();
let mut reader = BufReader::new(file);
let cert_list = rustls_pemfile::certs(&mut reader).unwrap();
let certs: Vec<Certificate> = cert_list.into_iter().map(Certificate).collect();
let key_file = File::open("/path/to/certs/privatekey.pem").unwrap();
let mut key_reader = BufReader::new(key_file);
let mut key_list = rustls_pemfile::pkcs8_private_keys(&mut key_reader).unwrap();
let key = PrivateKey(key_list.remove(0));
let mut client = match EppClient::connect("registry".to_string(), addr, host, Some((certs, key)), timeout).await {
Ok(client) => client,
Err(e) => panic!("Failed to create EppClient: {}", e)
};
let login = Login::new("username", "password", None, None);
client.transact(&login, "transaction-id").await.unwrap();
// Execute an EPP Command against the registry with distinct request and response objects
let domain_check = DomainCheck { domains: &["eppdev.com", "eppdev.net"] };
let response = client.transact(&domain_check, "transaction-id").await.unwrap();
response.res_data.unwrap().list
.iter()
.for_each(|chk| println!("Domain: {}, Available: {}", chk.id, chk.available));
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Please let us know where should i add certs
thanks
The text was updated successfully, but these errors were encountered: