Leaked source code of windows server 2003
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.

56 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. void GetIssuer( CString &sz );
  21. void GetIssuerCountry( CString &sz );
  22. void GetIssuerOrganization( CString &sz );
  23. void GetIssuerUnit( CString &sz );
  24. void GetSubject( CString &sz );
  25. void GetSubjectCountry( CString &sz );
  26. void GetSubjectState( CString &sz );
  27. void GetSubjectLocality( CString &sz );
  28. void GetSubjectCommonName( CString &sz );
  29. void GetSubjectOrganization( CString &sz );
  30. void GetSubjectUnit( CString &sz );
  31. protected:
  32. // string constants for distinguishing names. Not to be localized
  33. #define SZ_KEY_COUNTRY _T("C=")
  34. #define SZ_KEY_STATE _T("S=")
  35. #define SZ_KEY_LOCALITY _T("L=")
  36. #define SZ_KEY_ORGANIZATION _T("O=")
  37. #define SZ_KEY_ORGUNIT _T("OU=")
  38. #define SZ_KEY_COMNAME _T("CN=")
  39. private:
  40. void GetSubjectDN( CString &szDN, LPCTSTR szKey );
  41. void GetIssuerDN( CString &szDN, LPCTSTR szKey );
  42. // declare the x509 pointer as void so that the
  43. // files instantiating this don't have to include wincrypt
  44. PVOID m_pData;
  45. };