SSP21-CPP
Chain.h
1 
2 #ifndef SSP21_CHAIN_H
3 #define SSP21_CHAIN_H
4 
5 #include "ssp21/crypto/gen/CertificateBody.h"
6 #include "ssp21/crypto/gen/CertificateEnvelope.h"
7 #include "ssp21/crypto/gen/HandshakeError.h"
8 #include "ssp21/crypto/CryptoTypedefs.h"
9 
10 #include "ser4cpp/util/Uncopyable.h"
11 
12 namespace ssp21
13 {
14  /**
15  * Operations for verifying certificate chains
16  */
17  class Chain final : ser4cpp::StaticOnly
18  {
19 
20  public:
21 
22  /**
23  * Verify a certificate chain
24  *
25  * @param anchor certificate to verify against
26  * @param certificates Chain of unparsed certificate envelopes
27  * @param result verified terminal certificate if return value is HandshakeError::none
28  * @return Verification error or HandshakeError::none for success
29  *
30  */
31  static HandshakeError verify(const CertificateBody& anchor, const ICollection<CertificateEnvelope>& certificates, CertificateBody& result);
32 
33  /**
34  *
35  * Using the previously verified parent certifivate, verify the next untrusted child certificate
36  *
37  * @param parent trusted parent certificate body
38  * @param child certificate to be verified
39  * @param child_body if verification is successful, the fully parsed child certificate body is output in this parameter
40  * @return An error condition. HandshakeError::none, if the verification was successful
41  *
42  */
43  static HandshakeError verify_pair(const CertificateBody& parent, const CertificateEnvelope& child, CertificateBody& child_body);
44 
45  private:
46 
47  struct DSAInfo
48  {
49  verify_dsa_t verify;
50  uint8_t signature_length;
51  };
52 
53  static DSAInfo try_get_dsa_info(PublicKeyType type);
54 
55  static bool is_dh_key(PublicKeyType type);
56  };
57 }
58 
59 #endif
SSP21-cpp main namespace.
Definition: BufferTypes.h:12
static HandshakeError verify_pair(const CertificateBody &parent, const CertificateEnvelope &child, CertificateBody &child_body)
static HandshakeError verify(const CertificateBody &anchor, const ICollection< CertificateEnvelope > &certificates, CertificateBody &result)