Skip to main content

AuthenticodeConfig

Struct AuthenticodeConfig 

Source
pub struct AuthenticodeConfig {
    pub cert_file: Option<String>,
    pub cert_env: Option<String>,
    pub password_env: Option<String>,
    pub timestamp_url: Option<String>,
    pub name: Option<String>,
    pub url: Option<String>,
    pub tool: Option<String>,
    pub artifacts: Option<String>,
    pub required: Option<bool>,
}
Expand description

Authenticode (Windows PE/MSI/DLL) signing backend for a SignConfig.

Unlike the generic cosign/gpg signs: path — which produces a detached .sig next to the artifact — Authenticode signing embeds the signature into the PE/MSI container, mutating the artifact in place. Downstream checksums and archives then pick up the signed bytes; no separate signature artifact is registered.

Everything is derived so the opt-in is minimal — authenticode: {} plus a WINDOWS_CERT_FILE (and optional WINDOWS_CERT_PASSWORD) env var is enough:

signs:
  - authenticode: {}   # signs every .exe/.msi/.dll via osslsigncode/signtool

A fully-specified config overrides the derived defaults:

signs:
  - id: authenticode
    authenticode:
      cert_file: "{{ .Env.MY_CERT }}"     # or cert_env: MY_CERT_PATH
      password_env: MY_CERT_PASSWORD
      timestamp_url: "http://timestamp.sectigo.com"
      name: "Acme Corp"
      url: "https://acme.example"
      tool: osslsigncode
      artifacts: windows
      required: true

Fields§

§cert_file: Option<String>

Literal path to the PKCS#12 (.p12 / .pfx) cert file. May be a template (e.g. "{{ .Env.MY_CERT }}"). For a non-secret cert path checked into config; for a secret path prefer cert_env.

§cert_env: Option<String>

Name of the env var holding the path to the PKCS#12 cert file (never the cert bytes). Defaults to WINDOWS_CERT_FILE when neither this nor cert_file is set.

§password_env: Option<String>

Name of the env var holding the cert password. Defaults to WINDOWS_CERT_PASSWORD. The value is read at execution time, passed to the signer, and redacted from all logs.

§timestamp_url: Option<String>

RFC 3161 timestamp server URL. Defaults to DEFAULT_TIMESTAMP_URL.

§name: Option<String>

Product / publisher name embedded in the signature (osslsigncode -n, signtool /d). Templated. Derived from the project name when unset.

§url: Option<String>

Info URL embedded in the signature (osslsigncode -i, signtool /du). Omitted when unset.

§tool: Option<String>

Override the signer binary. Defaults to signtool on a Windows host, osslsigncode elsewhere.

§artifacts: Option<String>

Artifact selector. Defaults to "windows" — Binary/Installer/Library artifacts whose path ends in .exe, .msi, or .dll.

§required: Option<bool>

When true, a missing cert HARD-FAILS the sign stage. When false (the default), a missing cert SKIPS gracefully (mirrors the keyless-cosign-under-harness skip).

Implementations§

Source§

impl AuthenticodeConfig

Source

pub const DEFAULT_CERT_ENV: &'static str = "WINDOWS_CERT_FILE"

Default env var naming the cert path when neither cert_file nor cert_env is set ("WINDOWS_CERT_FILE").

Source

pub const DEFAULT_PASSWORD_ENV: &'static str = "WINDOWS_CERT_PASSWORD"

Default env var holding the cert password ("WINDOWS_CERT_PASSWORD").

Source

pub const DEFAULT_TIMESTAMP_URL: &'static str = "http://timestamp.digicert.com"

Default RFC 3161 timestamp server ("http://timestamp.digicert.com").

Source

pub const DEFAULT_ARTIFACTS: &'static str = "windows"

Default artifact selector ("windows").

Source

pub const DEFAULT_TOOL_WINDOWS: &'static str = "signtool"

Signer binary on a Windows host ("signtool").

Source

pub const DEFAULT_TOOL_UNIX: &'static str = "osslsigncode"

Signer binary on a non-Windows host ("osslsigncode").

Source

pub fn resolved_cert_env(&self) -> &str

Resolve the env var naming the cert path, falling back to DEFAULT_CERT_ENV.

Source

pub fn resolved_password_env(&self) -> &str

Resolve the env var holding the cert password, falling back to DEFAULT_PASSWORD_ENV.

Source

pub fn resolved_timestamp_url(&self) -> &str

Resolve the RFC 3161 timestamp URL, falling back to DEFAULT_TIMESTAMP_URL.

Source

pub fn resolved_artifacts(&self) -> &str

Resolve the artifact selector, falling back to DEFAULT_ARTIFACTS.

Source

pub fn resolved_tool(&self) -> &str

Resolve the signer binary, falling back to the host-appropriate default (signtool on Windows, osslsigncode elsewhere).

Source

pub fn is_required(&self) -> bool

Whether a missing cert HARD-FAILS (true) versus skips gracefully (false, the default).

Trait Implementations§

Source§

impl Clone for AuthenticodeConfig

Source§

fn clone(&self) -> AuthenticodeConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AuthenticodeConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for AuthenticodeConfig

Source§

fn default() -> AuthenticodeConfig

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for AuthenticodeConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl JsonSchema for AuthenticodeConfig

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

impl Serialize for AuthenticodeConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

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