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.

100 lines
4.2 KiB

  1. //+--------------------------------------------------------------------------
  2. //
  3. // Copyright (c) 1997-1999 Microsoft Corporation
  4. //
  5. // File:
  6. //
  7. // Contents:
  8. //
  9. // History:
  10. //
  11. //---------------------------------------------------------------------------
  12. // MS CD Key
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. typedef int SSRETCODE; // type for return codes
  17. #define SS_OK 0
  18. #define SS_BAD_KEYLENGTH 1
  19. #define SS_OTHER_ERROR 2
  20. #define SS_INVALID_SIGNATURE 3
  21. // The first DWORD of a Public or Private key is the total length of the key including
  22. // the DWORD length
  23. #ifndef SIG_VERIFY_ONLY ///////////////////////////////////////////////////////
  24. SSRETCODE CryptInit(); // Not needed for CryptVerifySig()
  25. SSRETCODE CryptGetKeyLens(
  26. LONG cbitSig, // [IN] count of bits in Sig
  27. LONG *pcbPrivate, // [OUT] ptr to number of bytes in the private key
  28. LONG *pcbPublic); // [OUT] ptr to number of bytes in the private key
  29. SSRETCODE CryptKeyGen(
  30. LONG cbRandom, // [IN] count of random Bytes
  31. LPVOID pvRandom, // [IN] ptr to array of random Bytes
  32. LONG cbitsSig, // [IN] count of bits in Sig
  33. LPVOID pvKeyPrivate,// [OUT] the generated private key
  34. LPVOID pvKeyPublic);// [OUT] the generated public key
  35. SSRETCODE CryptSign(
  36. LONG cbRandom, // [IN] count of random Bytes
  37. LPVOID pvRandom, // [IN] ptr to array of random Bytes
  38. LONG cbMsg, // [IN] number of bytes in message
  39. LPVOID pvMsg, // [IN] binary message to sign
  40. LONG cbKeyPrivate, // [IN] number of bytes in private key (from CryptGetKeyLens)
  41. LPVOID pvKeyPrivate,// [IN] the generated private key (from CryptKeyGen)
  42. LONG cbKeyPublic, // [IN] number of bytes in public key (from CryptGetKeyLens)
  43. LPVOID pvKeyPublic, // [IN] the generated public key (from CryptKeyGen)
  44. LONG cbitsSig, // [IN] the number of bits in the sig
  45. LPVOID pvSig); // [OUT] the digital signature
  46. SSRETCODE CryptSignBatch(
  47. LONG cbRandom, // [IN] count of random Bytes
  48. LPVOID pvRandom, // [IN] ptr to array of random Bytes
  49. LONG cbMsg, // [IN] number of bytes in message
  50. LPVOID pvMsg, // [IN] binary message to sign
  51. LONG cbKeyPrivate, // [IN] number of bytes in private key (from CryptGetKeyLens)
  52. LPVOID pvKeyPrivate,// [IN] the generated private key (from CryptKeyGen)
  53. LONG cbKeyPublic, // [IN] number of bytes in public key (from CryptGetKeyLens)
  54. LPVOID pvKeyPublic, // [IN] the generated public key (from CryptKeyGen)
  55. LONG cbitsSig, // [IN] the number of bits in the sig
  56. LPVOID pvSig, // [OUT] the digital signature
  57. LONG cMsg); // [IN] the count of messages to sign
  58. SSRETCODE CryptAuthenticate(
  59. LONG cbMsg, // [IN] number of bytes in message
  60. LPVOID pvMsg, // [IN] binary message to authenticate
  61. LONG cbKeyPrivate, // [IN] number of bytes in private key (from CryptGetKeyLens)
  62. LPVOID pvKeyPrivate,// [IN] the generated private key (from CryptKeyGen)
  63. LONG cbKeyPublic, // [IN] number of bytes in public key (from CryptGetKeyLens)
  64. LPVOID pvKeyPublic, // [IN] the generated public key (from CryptKeyGen)
  65. LONG cbitsSig, // [IN] the number of bits in the sig
  66. LPVOID pvSig); // [IN] the digital signature
  67. SSRETCODE CryptVerifySigFast(
  68. LONG cbMsg, // [IN] number of bytes in message
  69. LPVOID pvMsg, // [IN] binary message to Authenticate
  70. LONG cbKeyPublic, // [IN] number of bytes in public key (from CryptGetKeyLens)
  71. LPVOID pvKeyPublic, // [IN] the generated public key (from CryptKeyGen)
  72. LONG cbitsSig, // [IN] the number of bits in the sig
  73. LPVOID pvSig); // [IN] the digital signature
  74. #endif // ndef SIG_VERIFY_ONLY ///////////////////////////////////////////////
  75. SSRETCODE CryptVerifySig(
  76. LONG cbMsg, // [IN] number of bytes in message
  77. LPVOID pvMsg, // [IN] binary message to verify
  78. LONG cbKeyPublic, // [IN] number of bytes in public key (from CryptGetKeyLens)
  79. LPVOID pvKeyPublic, // [IN] the generated public key (from CryptKeyGen)
  80. LONG cbitsSig, // [IN] the number of bits in the sig
  81. LPVOID pvSig); // [IN] the digital signature (from CryptSign)
  82. #ifdef __cplusplus
  83. }
  84. #endif