Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cX509Csr.h
Go to the documentation of this file.
1 //
4 //
5 
6 #ifndef _INC_cX509Csr_H
7 #define _INC_cX509Csr_H
8 #ifndef NO_PRAGMA_ONCE
9 #pragma once
10 #endif
11 
12 #include "cX509Common.h"
13 #include "cX509Reader.h"
14 #include "../File/cASNSequence.h"
15 
16 namespace GrayLib
17 {
19  {
24 
25  typedef cX509Common SUPER_t;
26 
27  public:
28  static const char* k_pszPEM;
29 
32 
33  // extensions
34  // BYTE m_Ext_key_usage; // OID_KEY_USAGE
35  // BYTE m_Ext_ns_cert_type; // OID_NS_CERT_TYPE
36 
37  public:
38  cX509Csr() noexcept
39  {
40  }
42  {
43  SetEmptyX();
44  }
45 
46  virtual void SetEmptyX() override;
47  virtual HRESULT GetDescription(StrBuilder& s, const char* prefix) const override;
48 
49  virtual HRESULT ReadFromDer1(const BYTE* buf, size_t buflen) override;
50  virtual HRESULT ReadFromDER(const BYTE* buf, size_t buflen) override
51  {
52  return ReadFromDer1(buf, buflen); // NOT a list.
53  }
54 
55  virtual HRESULT ReadFromUnk(const BYTE* buf, size_t buflen) override;
56 
57  static HRESULT GRAYCALL WriteExt_KeyUsage(OUT cASNSets& sets, BYTE key_usage);
58  static HRESULT GRAYCALL WriteExt_NSCertType(OUT cASNSets& sets, BYTE ns_cert_type);
59 
60  HRESULT WriteToDER(BYTE* pBuffer, size_t size, const cASNSets& extensions, IRandomNoise* pRandom);
61 
62  HRESULT WriteToPEM(char* pOut, StrLen_t size, const cASNSets& extensions, IRandomNoise* pRandom);
63 
65  };
66 }
67 
68 #endif // _INC_cX509Csr_H
#define GRAYCALL
declare calling convention for static functions so everyone knows the arg passing scheme....
Definition: GrayCore.h:36
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
Definition: cASNSets.h:58
Definition: cKeyWrap.h:25
Definition: cX509Common.h:24
Definition: cX509Csr.h:19
cKeyWrap m_SubjectPublicKey
Container for the public key context.
Definition: cX509Csr.h:31
UNITTEST_FRIEND(cX509Csr)
~cX509Csr()
Definition: cX509Csr.h:41
cX509Csr() noexcept
Definition: cX509Csr.h:38
cASNSets m_subject
The parsed m_subject_raw (named information object).
Definition: cX509Csr.h:30
static const char * k_pszPEM
"CERTIFICATE REQUEST"
Definition: cX509Csr.h:28
virtual HRESULT ReadFromDER(const BYTE *buf, size_t buflen) override
Definition: cX509Csr.h:50
Definition: StrBuilder.h:18
Definition: cMesh.h:22
int StrLen_t
the length of a string in chars (bytes for UTF8, wchar_t for UNICODE). or offset in characters....
Definition: StrConst.h:32
Definition: cRandom.h:19