mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
rename Tls.*_cert() to Tls.*_rota()
actually this is a correction of the names of these fn these fn are actually handling trust_anchors rather than certificates and in some cases we will need equivalent fn for certificates
This commit is contained in:
parent
12c74e724f
commit
6e1947d3b0
2 changed files with 9 additions and 9 deletions
|
|
@ -21,7 +21,7 @@ pub fn shellchat<'a>(
|
||||||
Some("deleteall") => {
|
Some("deleteall") => {
|
||||||
log::info!("starting TLS delete certificates");
|
log::info!("starting TLS delete certificates");
|
||||||
let tls = Tls::new();
|
let tls = Tls::new();
|
||||||
let count = tls.del_all_cert().unwrap();
|
let count = tls.del_all_rota().unwrap();
|
||||||
write!(ret, "{} {}", count, t!("tls.deleteall_done", locales::LANG)).ok();
|
write!(ret, "{} {}", count, t!("tls.deleteall_done", locales::LANG)).ok();
|
||||||
log::info!("finished TLS delete certificates");
|
log::info!("finished TLS delete certificates");
|
||||||
}
|
}
|
||||||
|
|
@ -62,7 +62,7 @@ pub fn shellchat<'a>(
|
||||||
count = 0;
|
count = 0;
|
||||||
let tls = Tls::new();
|
let tls = Tls::new();
|
||||||
for rota in rotas {
|
for rota in rotas {
|
||||||
tls.save_cert(&rota).unwrap_or_else(|e| log::warn!("{e}"));
|
tls.save_rota(&rota).unwrap_or_else(|e| log::warn!("{e}"));
|
||||||
modals.update_progress(count).expect("no progress");
|
modals.update_progress(count).expect("no progress");
|
||||||
count += 1;
|
count += 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ impl Tls {
|
||||||
.map(|i| &certificates[*i].1)
|
.map(|i| &certificates[*i].1)
|
||||||
.map(|x509| RustlsOwnedTrustAnchor::from(x509))
|
.map(|x509| RustlsOwnedTrustAnchor::from(x509))
|
||||||
.for_each(|rota| {
|
.for_each(|rota| {
|
||||||
self.save_cert(&rota).unwrap_or_else(|e| {
|
self.save_rota(&rota).unwrap_or_else(|e| {
|
||||||
log::warn!("failed to save cert: {e}");
|
log::warn!("failed to save cert: {e}");
|
||||||
modals
|
modals
|
||||||
.show_notification(
|
.show_notification(
|
||||||
|
|
@ -109,7 +109,7 @@ impl Tls {
|
||||||
///
|
///
|
||||||
/// the number of trust-anchors deleted
|
/// the number of trust-anchors deleted
|
||||||
///
|
///
|
||||||
pub fn del_all_cert(&self) -> Result<usize, Error> {
|
pub fn del_all_rota(&self) -> Result<usize, Error> {
|
||||||
let count = match self.pddb.list_keys(TLS_TRUSTED_DICT, None) {
|
let count = match self.pddb.list_keys(TLS_TRUSTED_DICT, None) {
|
||||||
Ok(list) => list.len(),
|
Ok(list) => list.len(),
|
||||||
Err(_) => 0,
|
Err(_) => 0,
|
||||||
|
|
@ -137,7 +137,7 @@ impl Tls {
|
||||||
///
|
///
|
||||||
/// * `key` - the pddb-key containing the unwanted trust-anchor
|
/// * `key` - the pddb-key containing the unwanted trust-anchor
|
||||||
///
|
///
|
||||||
pub fn del_cert(&self, key: &str) -> Result<(), Error> {
|
pub fn del_rota(&self, key: &str) -> Result<(), Error> {
|
||||||
match self.pddb.delete_key(TLS_TRUSTED_DICT, key, None) {
|
match self.pddb.delete_key(TLS_TRUSTED_DICT, key, None) {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
log::info!("Deleted {}:{}\n", TLS_TRUSTED_DICT, key);
|
log::info!("Deleted {}:{}\n", TLS_TRUSTED_DICT, key);
|
||||||
|
|
@ -157,7 +157,7 @@ impl Tls {
|
||||||
///
|
///
|
||||||
/// * `ta` - a trusted trust-anchor
|
/// * `ta` - a trusted trust-anchor
|
||||||
///
|
///
|
||||||
pub fn save_cert(&self, ta: &RustlsOwnedTrustAnchor) -> Result<(), Error> {
|
pub fn save_rota(&self, ta: &RustlsOwnedTrustAnchor) -> Result<(), Error> {
|
||||||
let key = ta.pddb_key();
|
let key = ta.pddb_key();
|
||||||
match self.pddb.get(
|
match self.pddb.get(
|
||||||
TLS_TRUSTED_DICT,
|
TLS_TRUSTED_DICT,
|
||||||
|
|
@ -206,7 +206,7 @@ impl Tls {
|
||||||
///
|
///
|
||||||
/// * `key` - pddb key holding the trust-anchor
|
/// * `key` - pddb key holding the trust-anchor
|
||||||
///
|
///
|
||||||
pub fn get_cert(&self, key: &str) -> Option<RustlsOwnedTrustAnchor> {
|
pub fn get_rota(&self, key: &str) -> Option<RustlsOwnedTrustAnchor> {
|
||||||
match self.pddb.get(
|
match self.pddb.get(
|
||||||
TLS_TRUSTED_DICT,
|
TLS_TRUSTED_DICT,
|
||||||
key,
|
key,
|
||||||
|
|
@ -250,7 +250,7 @@ impl Tls {
|
||||||
match self.pddb.list_keys(TLS_TRUSTED_DICT, None) {
|
match self.pddb.list_keys(TLS_TRUSTED_DICT, None) {
|
||||||
Ok(list) => list
|
Ok(list) => list
|
||||||
.iter()
|
.iter()
|
||||||
.map(|key| self.get_cert(&key))
|
.map(|key| self.get_rota(&key))
|
||||||
.filter_map(|rota| rota)
|
.filter_map(|rota| rota)
|
||||||
.collect::<Vec<RustlsOwnedTrustAnchor>>(),
|
.collect::<Vec<RustlsOwnedTrustAnchor>>(),
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
|
@ -268,7 +268,7 @@ impl Tls {
|
||||||
Ok(list) => {
|
Ok(list) => {
|
||||||
let rota = list
|
let rota = list
|
||||||
.iter()
|
.iter()
|
||||||
.map(|key| self.get_cert(&key))
|
.map(|key| self.get_rota(&key))
|
||||||
.filter_map(|rota| rota)
|
.filter_map(|rota| rota)
|
||||||
.map(|t| Into::<rustls::OwnedTrustAnchor>::into(t));
|
.map(|t| Into::<rustls::OwnedTrustAnchor>::into(t));
|
||||||
root_store.add_trust_anchors(rota);
|
root_store.add_trust_anchors(rota);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue