Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
2.0 KiB

  1. class CCrackedCert
  2. {
  3. public:
  4. // constructor
  5. CCrackedCert();
  6. ~CCrackedCert();
  7. // give it a cert to crack. If this object was previously used to
  8. // crack a key, cleanup is automatically done and the new key is
  9. // cracked. - NOTE: The target key MUST have either a certificate
  10. // or a certificate request. Those are what get cracked. A return
  11. // value of 0 indicates success
  12. BOOL CrackCert( PUCHAR pCert, DWORD cbCert );
  13. // The rest of the methods access the data in the cracked certificate
  14. DWORD GetVersion();
  15. DWORD* PGetSerialNumber(); // returns a pointer to a DWORD[4]
  16. int GetSignatureAlgorithm();
  17. FILETIME GetValidFrom();
  18. FILETIME GetValidUntil();
  19. PVOID PSafePublicKey();
  20. DWORD GetBitLength();
  21. void GetIssuer( CString &sz );
  22. void GetIssuerCountry( CString &sz );
  23. void GetIssuerOrganization( CString &sz );
  24. void GetIssuerUnit( CString &sz );
  25. void GetSubject( CString &sz );
  26. void GetSubjectCountry( CString &sz );
  27. void GetSubjectState( CString &sz );
  28. void GetSubjectLocality( CString &sz );
  29. void GetSubjectCommonName( CString &sz );
  30. void GetSubjectOrganization( CString &sz );
  31. void GetSubjectUnit( CString &sz );
  32. protected:
  33. // string constants for distinguishing names. Not to be localized
  34. #define SZ_KEY_COUNTRY _T("C=")
  35. #define SZ_KEY_STATE _T("S=")
  36. #define SZ_KEY_LOCALITY _T("L=")
  37. #define SZ_KEY_ORGANIZATION _T("O=")
  38. #define SZ_KEY_ORGUNIT _T("OU=")
  39. #define SZ_KEY_COMNAME _T("CN=")
  40. private:
  41. void GetSubjectDN( CString &szDN, LPCTSTR szKey );
  42. void GetIssuerDN( CString &szDN, LPCTSTR szKey );
  43. // declare the x509 pointer as void so that the
  44. // files instantiating this don't have to include wincrypt
  45. PVOID m_pData;
  46. };