Skip to content

Commit 2834b1d

Browse files
authored
x509-cert: use BTreeSet instead of HashSet (#1642)
The former is available in liballoc. Closes #1641
1 parent a4f4ff7 commit 2834b1d

File tree

1 file changed

+5
-5
lines changed
  • x509-cert/src/builder/profile

1 file changed

+5
-5
lines changed

x509-cert/src/builder/profile/cabf.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
//! CA/Browser forum specific profiles
22
//!
33
//! <https://cabforum.org/wp-content/uploads/CA-Browser-Forum-BR-v2.0.1.pdf>
4-
use alloc::vec;
5-
use std::collections::HashSet;
4+
5+
use alloc::{collections::BTreeSet, vec};
66

77
use crate::{
88
builder::{BuilderProfile, Error, Result},
@@ -41,7 +41,7 @@ pub fn check_names_encoding(name: &Name, multiple_allowed: bool) -> Result<()> {
4141
];
4242
let mut ordering = enforce_ordering.iter();
4343

44-
let mut seen = HashSet::new();
44+
let mut seen = BTreeSet::new();
4545

4646
for rdn in name.iter_rdn() {
4747
if rdn.len() != 1 {
@@ -70,12 +70,12 @@ pub fn check_names_encoding(name: &Name, multiple_allowed: bool) -> Result<()> {
7070
///
7171
/// BR 7.1.2.10.2 CA Certificate Naming
7272
pub fn ca_certificate_naming(subject: &Name) -> Result<()> {
73-
let mut required = HashSet::from([
73+
let mut required = BTreeSet::from([
7474
rfc4519::COUNTRY_NAME,
7575
rfc4519::ORGANIZATION_NAME,
7676
rfc4519::COMMON_NAME,
7777
]);
78-
let mut allowed = HashSet::from([
78+
let mut allowed = BTreeSet::from([
7979
rfc4519::COUNTRY_NAME,
8080
rfc2256::STATE_OR_PROVINCE_NAME,
8181
rfc4519::LOCALITY_NAME,

0 commit comments

Comments
 (0)