Rename PLUGIN_NAME to BINARY_NAME

This commit is contained in:
Jack Grigg
2021-04-12 22:31:46 +12:00
parent 771cad885a
commit 63c8d6c303
3 changed files with 6 additions and 6 deletions
+2 -2
View File
@@ -12,7 +12,7 @@ use crate::{
p256::Recipient, p256::Recipient,
util::POLICY_EXTENSION_OID, util::POLICY_EXTENSION_OID,
yubikey::{self, Stub}, yubikey::{self, Stub},
PLUGIN_NAME, USABLE_SLOTS, BINARY_NAME, USABLE_SLOTS,
}; };
const DEFAULT_PIN_POLICY: PinPolicy = PinPolicy::Once; const DEFAULT_PIN_POLICY: PinPolicy = PinPolicy::Once;
@@ -129,7 +129,7 @@ impl IdentityBuilder {
serial, serial,
None, None,
&[ &[
RelativeDistinguishedName::organization(PLUGIN_NAME), RelativeDistinguishedName::organization(BINARY_NAME),
RelativeDistinguishedName::organizational_unit(env!("CARGO_PKG_VERSION")), RelativeDistinguishedName::organizational_unit(env!("CARGO_PKG_VERSION")),
RelativeDistinguishedName::common_name(&name), RelativeDistinguishedName::common_name(&name),
], ],
+2 -2
View File
@@ -19,7 +19,7 @@ mod yubikey;
use error::Error; use error::Error;
const PLUGIN_NAME: &str = "age-plugin-yubikey"; const BINARY_NAME: &str = "age-plugin-yubikey";
const RECIPIENT_PREFIX: &str = "age1yubikey"; const RECIPIENT_PREFIX: &str = "age1yubikey";
const IDENTITY_PREFIX: &str = "age-plugin-yubikey-"; const IDENTITY_PREFIX: &str = "age-plugin-yubikey-";
const STANZA_TAG: &str = "piv-p256"; const STANZA_TAG: &str = "piv-p256";
@@ -157,7 +157,7 @@ fn identity(opts: PluginOptions) -> Result<(), Error> {
.as_ref() .as_ref()
.and_then(|cert| cert.subject().iter_organization().next()) .and_then(|cert| cert.subject().iter_organization().next())
{ {
Some(org) => org.as_str() == Ok(PLUGIN_NAME), Some(org) => org.as_str() == Ok(BINARY_NAME),
_ => false, _ => false,
} }
}); });
+2 -2
View File
@@ -5,7 +5,7 @@ use yubikey_piv::{
Key, YubiKey, Key, YubiKey,
}; };
use crate::{error::Error, p256::Recipient, yubikey::Stub, PLUGIN_NAME, USABLE_SLOTS}; use crate::{error::Error, p256::Recipient, yubikey::Stub, BINARY_NAME, USABLE_SLOTS};
pub(crate) const POLICY_EXTENSION_OID: &[u64] = &[1, 3, 6, 1, 4, 1, 41482, 3, 8]; pub(crate) const POLICY_EXTENSION_OID: &[u64] = &[1, 3, 6, 1, 4, 1, 41482, 3, 8];
@@ -63,7 +63,7 @@ pub(crate) fn touch_policy_to_str(policy: Option<TouchPolicy>) -> &'static str {
pub(crate) fn extract_name(cert: &X509Certificate, all: bool) -> Option<(String, bool)> { pub(crate) fn extract_name(cert: &X509Certificate, all: bool) -> Option<(String, bool)> {
// Look at Subject Organization to determine if we created this. // Look at Subject Organization to determine if we created this.
match cert.subject().iter_organization().next() { match cert.subject().iter_organization().next() {
Some(org) if org.as_str() == Ok(PLUGIN_NAME) => { Some(org) if org.as_str() == Ok(BINARY_NAME) => {
// We store the identity name as a Common Name attribute. // We store the identity name as a Common Name attribute.
let name = cert let name = cert
.subject() .subject()