vmgstool

Enum Options

Source
pub(crate) enum Options {
    Create {
        file_path: FilePathArg,
        file_size: Option<u64>,
        key_path: Option<PathBuf>,
        encryption_algorithm: Option<EncryptionAlgorithm>,
        force_create: bool,
    },
    Write {
        file_path: FilePathArg,
        data_path: PathBuf,
        file_id: FileIdArg,
        key_path: KeyPathArg,
        allow_overwrite: bool,
    },
    Dump {
        file_path: FilePathArg,
        data_path: Option<PathBuf>,
        file_id: FileIdArg,
        key_path: KeyPathArg,
        raw_stdout: bool,
    },
    DumpHeaders {
        file_path: FilePathArg,
    },
    QuerySize {
        file_path: FilePathArg,
        file_id: FileIdArg,
    },
    UpdateKey {
        file_path: FilePathArg,
        key_path: PathBuf,
        new_key_path: PathBuf,
        encryption_algorithm: EncryptionAlgorithm,
    },
    Encrypt {
        file_path: FilePathArg,
        key_path: PathBuf,
        encryption_algorithm: EncryptionAlgorithm,
    },
    QueryEncryption {
        file_path: FilePathArg,
    },
    UefiNvram {
        operation: UefiNvramOperation,
    },
}

Variants§

§

Create

Create and initialize filepath as a VMGS file of size filesize.

keypath and encryptionalgorithm must both be specified if encrypted guest state is required.

Fields

§file_path: FilePathArg
§file_size: Option<u64>

VMGS file size, default = 4194816 (~4MB)

§key_path: Option<PathBuf>

Encryption key file path. The file must contain a key that is 32 bytes long.

encryptionalgorithm must also be specified when using this flag.

§encryption_algorithm: Option<EncryptionAlgorithm>

Encryption algorithm. Currently AES_GCM is the only algorithm supported.

keypath must also be specified when using this flag.

§force_create: bool

Force creation of the VMGS file. If the VMGS filepath already exists, this flag allows an existing file to be overwritten.

§

Write

Write data into the specified file ID of the VMGS file.

The proper key file must be specified to write encrypted data.

Fields

§file_path: FilePathArg
§data_path: PathBuf

Data file path to read

§file_id: FileIdArg
§key_path: KeyPathArg
§allow_overwrite: bool

Overwrite the VMGS data at fileid, even if it already exists with nonzero size

§

Dump

Dump/read data from the specified file ID of the VMGS file.

The proper key file must be specified to read encrypted data. If the data is encrypted and no key is specified, the data will be dumped without decrypting.

Fields

§file_path: FilePathArg
§data_path: Option<PathBuf>

Data file path to write

§file_id: FileIdArg
§key_path: KeyPathArg
§raw_stdout: bool

When dumping to stdout, dump data as raw bytes instead of ASCII hex

§

DumpHeaders

Dump headers of the VMGS file at filepath to the console.

Fields

§file_path: FilePathArg
§

QuerySize

Get the size of the specified fileid within the VMGS file

Fields

§file_path: FilePathArg
§file_id: FileIdArg
§

UpdateKey

Replace the current encryption key with a new provided key

Both key files must contain a key that is 32 bytes long.

Fields

§file_path: FilePathArg
§key_path: PathBuf

Current encryption key file path.

§new_key_path: PathBuf

New encryption key file path.

§encryption_algorithm: EncryptionAlgorithm

Encryption algorithm. Currently AES_GCM is the only algorithm supported.

§

Encrypt

Encrypt an existing VMGS file

Fields

§file_path: FilePathArg
§key_path: PathBuf

Encryption key file path. The file must contain a key that is 32 bytes long.

§encryption_algorithm: EncryptionAlgorithm

Encryption algorithm. Currently AES_GCM is the only algorithm supported.

§

QueryEncryption

Query whether a VMGS file is encrypted

Fields

§file_path: FilePathArg
§

UefiNvram

UEFI NVRAM operations

Fields

Trait Implementations§

Source§

impl CommandFactory for Options

Source§

fn command<'b>() -> Command

Build a [Command] that can instantiate Self. Read more
Source§

fn command_for_update<'b>() -> Command

Build a [Command] that can update self. Read more
Source§

impl FromArgMatches for Options

Source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
Source§

fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
Source§

fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

fn update_from_arg_matches_mut<'b>( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

impl Parser for Options

§

fn parse() -> Self

Parse from std::env::args_os(), [exit][Error::exit] on error.
§

fn try_parse() -> Result<Self, Error>

Parse from std::env::args_os(), return Err on error.
§

fn parse_from<I, T>(itr: I) -> Self
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Parse from iterator, [exit][Error::exit] on error.
§

fn try_parse_from<I, T>(itr: I) -> Result<Self, Error>
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Parse from iterator, return Err on error.
§

fn update_from<I, T>(&mut self, itr: I)
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Update from iterator, [exit][Error::exit] on error. Read more
§

fn try_update_from<I, T>(&mut self, itr: I) -> Result<(), Error>
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Update from iterator, return Err on error.
Source§

impl Subcommand for Options

Source§

fn augment_subcommands<'b>(__clap_app: Command) -> Command

Append to [Command] so it can instantiate Self via [FromArgMatches::from_arg_matches_mut] Read more
Source§

fn augment_subcommands_for_update<'b>(__clap_app: Command) -> Command

Append to [Command] so it can instantiate self via [FromArgMatches::update_from_arg_matches_mut] Read more
Source§

fn has_subcommand(__clap_name: &str) -> bool

Test whether Self can parse a specific subcommand

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more