MCPcopy Create free account
hub / github.com/chirpstack/chirpstack / wrap

Function wrap

chirpstack/src/backend/keywrap.rs:27–40  ·  view source on GitHub ↗
(label: &str, key: AES128Key)

Source from the content-addressed store, hash-verified

25}
26
27pub fn wrap(label: &str, key: AES128Key) -> Result<KeyEnvelope> {
28 if label.is_empty() {
29 return KeyEnvelope::new("", None, &key.to_bytes());
30 }
31
32 let conf = config::get();
33 for kek in &conf.keks {
34 if kek.label == *label {
35 return KeyEnvelope::new(label, Some(&kek.kek.to_bytes()), &key.to_bytes());
36 }
37 }
38
39 Err(anyhow!("KEK label {} does not exist", label))
40}

Callers 2

Calls 2

getFunction · 0.70
to_bytesMethod · 0.45

Tested by

no test coverage detected