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.

101 lines
4.0 KiB

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