Struct keyutils::Key
[−]
[src]
pub struct Key { /* fields omitted */ }
Methods
impl Key
[src]
Representation of a kernel key.
fn request_key_auth_key(create: bool) -> Result<Self>
Requests a key with the given description by searching the thread, process, and session keyrings.
fn request(description: &str) -> Result<Self>
Requests a key with the given description by searching the thread, process, and session keyrings.
fn request_with_fallback(description: &str, info: &str) -> Result<Self>
Requests a key with the given description by searching the thread, process, and session
keyrings. If it is not found, the info
string will be handed off to /sbin/request-key
to generate the key.
fn update(&mut self, data: &[u8]) -> Result<()>
Update the payload in the key.
fn revoke(self) -> Result<()>
Revokes the key. Requires write
permission on the key.
fn chown(&mut self, uid: uid_t) -> Result<()>
Change the user which owns the key. Requires the setattr
permission on the key and the
SysAdmin capability to change it to anything other than the current user.
fn chgrp(&mut self, gid: gid_t) -> Result<()>
Change the group which owns the key. Requires the setattr
permission on the key and the
SysAdmin capability to change it to anything other than a group of which the current user
is a member.
fn set_permissions(&mut self, perms: KeyPermissions) -> Result<()>
Set the permissions on the key. Requires the setattr
permission on the key and the
SysAdmin capability if the current user does not own the key.
fn description(&self) -> Result<KeyDescription>
Retrieve metadata about the key.
Panics
If the kernel returns malformed data, the the parser will panic.
fn read(&self) -> Result<Vec<u8>>
Read the payload of the key. Requires read
permissions on the key.
fn set_timeout(&mut self, timeout: u32) -> Result<()>
Set an expiration timer on the key to timeout
seconds in the future. A timeout of 0 means
"no expiration". Requires the setattr
permission on the key.
fn security(&self) -> Result<String>
The security context of the key. Depends on the security manager loaded into the kernel (e.g., SELinux or AppArmor).
fn invalidate(self) -> Result<()>
Invalidates the key and schedules it for removal. Requires the search
permission on the
key.
fn manage(&mut self) -> Result<KeyManager>
Create an object to manage a key request.