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.

145 lines
4.5 KiB

  1. //-----------------------------------------------------------------------------
  2. //
  3. // File: license.h
  4. //
  5. // Microsoft Digital Rights Management
  6. // Copyright (C) Microsoft Corporation, 1998 - 1999, All Rights Reserved
  7. //
  8. // Description:
  9. //
  10. //-----------------------------------------------------------------------------
  11. #ifndef __LICENSE_H__
  12. #define __LICENSE_H__
  13. #include "widestr.h" // XPLAT
  14. #include "pkcrypto.h"
  15. #define VERSION_LEN 4
  16. #define DATE_LEN 4
  17. #define SER_NUM_LEN 4
  18. #define ISSUER_LEN 4
  19. #define SUBJ_LEN 4
  20. #define INT_LEN 4
  21. #define EXPORTKEYLEN 7
  22. // Constant indicating the number of times SHA has to be used to get the hash of key.
  23. // This hash is used to check whether the key is good or bad.
  24. // CHECKSUM_LENGTH indicates the number of bytes in final hash value to use as CHECKSUM.
  25. #define SHA_ITERATIONS 5
  26. #define CHECKSUM_LENGTH 7
  27. #define APPSEC_LEN 4
  28. #define KIDLEN 25
  29. #define VERSION_LEN 4
  30. #define DATE_LEN 4
  31. #define RIGHTS_LEN 4
  32. #define APPSEC_LEN 4
  33. #define INT_LEN 4
  34. // Version Format: a.b.c.d
  35. // a = not used.
  36. // b = major version
  37. // c = minor version
  38. // d = revision version
  39. #define DRM_VERSION_STRING WIDESTR( "2.0.0.0" )
  40. const BYTE DRM_VERSION[VERSION_LEN] = {2, 0, 0, 0}; // DRM Version. Keep this in sync with DRM_VERSION_STRING above.
  41. const BYTE PK_VER[VERSION_LEN] = {2, 0, 0, 0}; // Indicates the version of the pubkey to be used for verification of PK CERT.
  42. const BYTE KEYFILE_VER[VERSION_LEN] = {2, 0, 0, 0}; // Version of the key file.
  43. #define LICREQUEST_VER_STRING WIDESTR( "2.0.0.0" )
  44. const BYTE LICREQUEST_VER[VERSION_LEN] = {2, 0, 0, 0};
  45. const BYTE CERT_VER[VERSION_LEN] = {0, 1, 0, 0}; // Indicates the public root key needed to verify the license server certificates.
  46. #define LICENSE_VER_STRING WIDESTR( "2.0.0.0" )
  47. const BYTE LICENSE_VER[VERSION_LEN] = {2, 0, 0, 0}; // Indicates the license version delivered.
  48. const BYTE CLIENT_ID_VER[VERSION_LEN] = {2, 0, 0, 0}; // The version for client id.
  49. #define CONTENT_VERSION_STRING WIDESTR( "2.0.0.0" )
  50. const BYTE CONTENT_VERSION[VERSION_LEN] = {2, 0, 0, 0}; // Content Version. Keep this in sync with CONTENT_VERSION_STRING above.
  51. #define PM_LICENSE_VER_STRING WIDESTR( "0.1.0.0" )
  52. const BYTE PM_LICENSE_VER[VERSION_LEN] = {0, 1, 0, 0}; // Indicates the license version delivered to PMs
  53. // For blackbox version, we have the following convention.
  54. // a.b.c.d. a.b => release number. c => reserved. d => category.
  55. #define WIN32_INDIVBOX_CATEGORY 1
  56. const BYTE APPCERT_VER[VERSION_LEN] = {0, 1, 0, 0};
  57. const BYTE APPCERT_PK_VER[VERSION_LEN] = {0, 1, 0, 0};
  58. #define SDK_CERTS_COUNT 4
  59. const BYTE APPCERT_SUBJECT_SDKSTUBS[SDK_CERTS_COUNT][SUBJ_LEN] = {{0, 0, 0, 200}, {0, 0, 0, 204}, {0, 0, 0, 208}, {0, 0, 0, 212}};
  60. typedef struct {
  61. PUBKEY pk;
  62. BYTE version[VERSION_LEN];
  63. } PK;
  64. typedef struct {
  65. PK pk; // pk.version indicates the pubkey needed to verify.
  66. BYTE sign[PK_ENC_SIGNATURE_LEN];
  67. } PKCERT;
  68. typedef struct {
  69. BYTE version[VERSION_LEN];
  70. BYTE randNum[PK_ENC_CIPHERTEXT_LEN];
  71. PKCERT pk;
  72. } CLIENTID;
  73. //----------------cert section -----------------------
  74. typedef struct CERTDATAtag{
  75. PUBKEY pk;
  76. BYTE expiryDate[DATE_LEN];
  77. BYTE serialNumber[SER_NUM_LEN];
  78. BYTE issuer[ISSUER_LEN];
  79. BYTE subject[SUBJ_LEN];
  80. } CERTDATA, *PCERTDATA;
  81. typedef struct CERTtag{
  82. BYTE certVersion[VERSION_LEN];
  83. BYTE datalen[INT_LEN];
  84. BYTE sign[PK_ENC_SIGNATURE_LEN];
  85. CERTDATA cd;
  86. } CERT, *PCERT;
  87. typedef struct {
  88. PK pk;
  89. BYTE appSec[APPSEC_LEN];
  90. BYTE subject[SUBJ_LEN];
  91. } APPCERTDATA;
  92. typedef struct {
  93. BYTE appcertVersion[VERSION_LEN];
  94. BYTE datalen[INT_LEN];
  95. BYTE sign[PK_ENC_SIGNATURE_LEN];
  96. APPCERTDATA appcd;
  97. } APPCERT;
  98. typedef struct {
  99. char KID[KIDLEN];
  100. BYTE key[PK_ENC_CIPHERTEXT_LEN]; // encrypted with DRM PK
  101. BYTE rights[RIGHTS_LEN];
  102. BYTE appSec[APPSEC_LEN];
  103. BYTE expiryDate[DATE_LEN];
  104. } LICENSEDATA;
  105. typedef struct {
  106. BYTE licVersion[VERSION_LEN];
  107. BYTE datalen[INT_LEN];
  108. BYTE sign[PK_ENC_SIGNATURE_LEN]; // signature over licensedata
  109. LICENSEDATA ld;
  110. } LICENSE;
  111. #endif