///|
/// The short attribute name that RFC 4514 uses for a distinguished name
/// attribute, or `None` for attributes without a registered short name.
pub fn attribute_short_name(oid : @asn1.ObjectIdentifier) -> String? {
  match oid.to_string() {
    "2.5.4.3" => Some("CN")
    "2.5.4.4" => Some("SN")
    "2.5.4.5" => Some("serialNumber")
    "2.5.4.6" => Some("C")
    "2.5.4.7" => Some("L")
    "2.5.4.8" => Some("ST")
    "2.5.4.9" => Some("street")
    "2.5.4.10" => Some("O")
    "2.5.4.11" => Some("OU")
    "2.5.4.12" => Some("title")
    "2.5.4.42" => Some("GN")
    "0.9.2342.19200300.100.1.25" => Some("DC")
    "1.2.840.113549.1.9.1" => Some("emailAddress")
    _ => None
  }
}

///|
/// The display name for a distinguished name attribute, falling back to the
/// dotted form of the object identifier.
pub fn attribute_display_name(oid : @asn1.ObjectIdentifier) -> String {
  match attribute_short_name(oid) {
    Some(name) => name
    None => oid.to_string()
  }
}

///|
/// The display name for a signature or public key algorithm, falling back to
/// the dotted form of the object identifier.
pub fn algorithm_display_name(oid : @asn1.ObjectIdentifier) -> String {
  match oid.to_string() {
    "1.2.840.113549.1.1.1" => "rsaEncryption"
    "1.2.840.113549.1.1.5" => "sha1WithRSAEncryption"
    "1.2.840.113549.1.1.10" => "RSASSA-PSS"
    "1.2.840.113549.1.1.11" => "sha256WithRSAEncryption"
    "1.2.840.113549.1.1.12" => "sha384WithRSAEncryption"
    "1.2.840.113549.1.1.13" => "sha512WithRSAEncryption"
    "1.2.840.10045.2.1" => "id-ecPublicKey"
    "1.2.840.10045.4.3.2" => "ecdsa-with-SHA256"
    "1.2.840.10045.4.3.3" => "ecdsa-with-SHA384"
    "1.2.840.10045.4.3.4" => "ecdsa-with-SHA512"
    "1.3.101.112" => "Ed25519"
    "2.16.840.1.101.3.4.3.2" => "dsa-with-SHA256"
    _ => oid.to_string()
  }
}

///|
/// The display name for a certification request attribute.
pub fn request_attribute_display_name(oid : @asn1.ObjectIdentifier) -> String {
  match oid.to_string() {
    "1.2.840.113549.1.9.2" => "unstructuredName"
    "1.2.840.113549.1.9.7" => "challengePassword"
    "1.2.840.113549.1.9.14" => "extensionRequest"
    "1.2.840.113549.1.9.15" => "smimeCapabilities"
    "1.2.840.113549.1.9.20" => "friendlyName"
    _ => oid.to_string()
  }
}

///|
/// The display name for an extended key usage purpose.
pub fn extended_key_usage_display_name(oid : @asn1.ObjectIdentifier) -> String {
  match oid.to_string() {
    "2.5.29.37.0" => "anyExtendedKeyUsage"
    "1.3.6.1.5.5.7.3.1" => "serverAuth"
    "1.3.6.1.5.5.7.3.2" => "clientAuth"
    "1.3.6.1.5.5.7.3.3" => "codeSigning"
    "1.3.6.1.5.5.7.3.4" => "emailProtection"
    "1.3.6.1.5.5.7.3.8" => "timeStamping"
    "1.3.6.1.5.5.7.3.9" => "OCSPSigning"
    _ => oid.to_string()
  }
}

///|
/// The display name for an extension, falling back to the dotted form of the
/// object identifier.
pub fn extension_display_name(oid : @asn1.ObjectIdentifier) -> String {
  match oid.to_string() {
    "2.5.29.9" => "subjectDirectoryAttributes"
    "2.5.29.14" => "subjectKeyIdentifier"
    "2.5.29.15" => "keyUsage"
    "2.5.29.16" => "privateKeyUsagePeriod"
    "2.5.29.17" => "subjectAltName"
    "2.5.29.18" => "issuerAltName"
    "2.5.29.19" => "basicConstraints"
    "2.5.29.20" => "cRLNumber"
    "2.5.29.21" => "cRLReason"
    "2.5.29.23" => "holdInstructionCode"
    "2.5.29.24" => "invalidityDate"
    "2.5.29.27" => "deltaCRLIndicator"
    "2.5.29.28" => "issuingDistributionPoint"
    "2.5.29.29" => "certificateIssuer"
    "2.5.29.30" => "nameConstraints"
    "2.5.29.31" => "cRLDistributionPoints"
    "2.5.29.32" => "certificatePolicies"
    "2.5.29.33" => "policyMappings"
    "2.5.29.35" => "authorityKeyIdentifier"
    "2.5.29.36" => "policyConstraints"
    "2.5.29.37" => "extKeyUsage"
    "1.3.6.1.5.5.7.1.1" => "authorityInfoAccess"
    "1.3.6.1.5.5.7.1.11" => "subjectInfoAccess"
    "1.3.6.1.5.5.7.1.24" => "tlsFeature"
    _ => oid.to_string()
  }
}