https://github.com/visa/kmip
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/visa/kmip
- Owner: visa
- License: apache-2.0
- Created: 2019-11-27T04:43:56.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-07-23T17:45:48.000Z (about 6 years ago)
- Last Synced: 2025-03-26T19:04:27.268Z (over 1 year ago)
- Language: Rust
- Size: 9.77 KB
- Stars: 4
- Watchers: 14
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# kmip
From [Wikipedia](https://en.wikipedia.org/wiki/Key_Management_Interoperability_Protocol_(KMIP)):
> The Key Management Interoperability Protocol (KMIP) is an extensible communication protocol that defines message formats for the manipulation of cryptographic keys on a key management server. This facilitates data encryption by simplifying encryption key management.
`kmip` is a `#![no_std]` crate that provides the ability to encode and decode KMIP messages. Due to incredibly wide scope of KMIP, only a subset of capabilities defined in the v1.3 spec are supported at this time.
KMIP spec:
## Usage
```rust
use kmip::{self, ttlv::{Ttlv, parse_ttlv_len}};
let key_name: &str = "test_key_name";
let creds: Option<(&str, &str)> = Some(("username", "password"));
let kmip_max_buffer_len: usize = 1024;
// Encode locate request to buffer
let buf = &mut [0u8; kmip_max_buffer_len];
let request_len = kmip::request(creds, kmip::locate(key_name)).encode(buf)?;
// Send/recieve over tls stream
let tls = unimplemented!();
tls.flush()?;
tls.write(&buf[..request_len])?;
tls.read(&mut buf[..8])?;
let response_len = parse_ttlv_len(&buf[4..8]) + 8;
tls.read(&mut buf[8..response_len])?;
// Decode locate response from buffer
let (ttlv_response, parsed_len) = Ttlv::decode(&buf[..response_len])?;
assert_eq!(response_len, parsed_len);
// Parse response and collect UUID
let uuid: &str = kmip::collect_uuid(kmip::collect_response_payload(&ttlv_response)?)?;
```
## License
Licensed under either of
* Apache License, Version 2.0
([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
* MIT license
([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
at your option.
## Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
dual licensed as above, without any additional terms or conditions.