Fingerprints.h
Go to the documentation of this file.
1 /****
2  * Sming Framework Project - Open Source framework for high efficiency native ESP8266 development.
3  * Created 2015 by Skurydin Alexey
4  * http://github.com/SmingHub/Sming
5  * All files of the Sming Core are provided under the LGPL v3 license.
6  *
7  * Fingerprints.h
8  *
9  ****/
10 
11 #pragma once
12 
13 #include <Crypto.h>
14 #include <BitManipulations.h>
15 
16 namespace Ssl
17 {
26 union Fingerprint {
30  enum class Type {
31  CertSha1,
32  CertSha256,
33  PkiSha256,
34  };
38  class Types
39  {
40  public:
41  void add(Type type)
42  {
43  bitSet(mask, type);
44  }
45 
46  void remove(Type type)
47  {
48  bitClear(mask, type);
49  }
50 
51  bool contains(Type type) const
52  {
53  return bitRead(mask, type);
54  }
55 
56  private:
57  uint32_t mask = 0;
58  };
59 
63  union Cert {
73  struct Sha1 {
74  static constexpr Type type = Type::CertSha1;
76  };
78 
83  struct Sha256 {
84  static constexpr Type type = Type::CertSha256;
86  };
88  };
90 
94  union Pki {
104  struct Sha256 {
105  static constexpr Type type = Type::PkiSha256;
107  };
109  };
111 };
112 
113 } // namespace Ssl
Fingerprint based on the SHA256 value of the Public Key Subject in the certificate.
Definition: Fingerprints.h:104
Definition: Fingerprints.h:94
Definition: Alert.h:15
bool contains(Type type) const
Definition: Fingerprints.h:51
Various types of fingerprint.
Definition: Fingerprints.h:26
ByteArray< Engine::hashsize > Hash
Definition: HashContext.h:27
Sha1 sha1
Definition: Fingerprints.h:77
Cert cert
Definition: Fingerprints.h:89
Crypto::Sha256::Hash hash
Definition: Fingerprints.h:106
Fingerprint based on the SHA256 value of the certificate.
Definition: Fingerprints.h:83
Type
SSL Certificate fingerprint type.
Definition: Fingerprints.h:30
Pki pki
Definition: Fingerprints.h:110
Crypto::Sha1::Hash hash
Definition: Fingerprints.h:75
Maintains a set of fingerprint types.
Definition: Fingerprints.h:38
Sha256 sha256
Definition: Fingerprints.h:108
SHA256 Fingerprint of entire certificate.
void add(Type type)
Definition: Fingerprints.h:41
Sha256 sha256
Definition: Fingerprints.h:87
SHA1 Fingerprint of entire certificate.
SHA256 Fingerprint of Public Key Information.
#define bitRead(value, bit)
Definition: BitManipulations.h:18
Fingerprint based on the SHA1 value of the certificate.
Definition: Fingerprints.h:73
Fingerprints for the entire Certificate.
Definition: Fingerprints.h:63
#define bitClear(value, bit)
Definition: BitManipulations.h:20
Crypto::Sha256::Hash hash
Definition: Fingerprints.h:85
#define bitSet(value, bit)
Definition: BitManipulations.h:19