@@ -33,14 +33,16 @@ pub enum Error {
3333 #[ error( "Multiple errors occurred" ) ]
3434 ErrorCollection ( Vec < Error > ) ,
3535}
36+ /// Type alias to make code more readable.
37+ type Issuer = Arc < Certificate > ;
3638
3739/// A pair of a certificate and the corresponding private key.
3840pub struct Certificate {
3941 certificate : rcgen:: Certificate ,
4042 key : KeyPair ,
4143 export_key : bool ,
4244 name : String ,
43- issuer : Option < Arc < Certificate > > ,
45+ issuer : Option < Issuer > ,
4446}
4547
4648impl PartialEq for Certificate {
@@ -73,6 +75,7 @@ impl Certificate {
7375 if current_issuer. issuer . is_none ( ) {
7476 // NOTE: If we have no issuer anymore we are at top level
7577 // and do not include the root ca.
78+ // See [RFC 5246](https://www.rfc-editor.org/rfc/rfc5246#section-7.4.2)
7679 break ;
7780 }
7881 cert. write_fmt ( format_args ! ( "{}" , current_issuer. certificate. pem( ) ) )
@@ -122,7 +125,7 @@ pub fn generate(certificate_config: &CertificateRoot) -> Result<Vec<Arc<Certific
122125fn generate_certificates (
123126 name : & str ,
124127 config : & CertificateType ,
125- issuer : Option < & Arc < Certificate > > ,
128+ issuer : Option < & Issuer > ,
126129) -> Result < Vec < Arc < Certificate > > , Error > {
127130 let mut result = vec ! [ ] ;
128131 let issuer = config. build ( name, issuer) ?;
0 commit comments