AipFileInfo.cs 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. using System;
  2. using System.Collections.Generic;
  3. using Microsoft.InformationProtection;
  4. namespace AipGateway.AIP
  5. {
  6. public enum AipAssignmentMethod
  7. {
  8. /// <summary>Label assignment method is standard</summary>
  9. Standard,
  10. /// <summary>Label assignment method is privileged</summary>
  11. Privileged,
  12. /// <summary>Label assignment method is automatic</summary>
  13. Auto,
  14. }
  15. public enum AipProtectionType
  16. {
  17. /// <summary>Protection was created from a template</summary>
  18. TemplateBased,
  19. /// <summary>Protection was created ad hoc</summary>
  20. Custom,
  21. }
  22. public class AipLabelInfo
  23. {
  24. /// <summary>The unique GUID for the label within the tenant</summary>
  25. public string LabelId { get; set; } = "";
  26. /// <summary>GUID of the tenant that owns the label</summary>
  27. public string TenantId { get; set; } = "";
  28. }
  29. public class AipProtectionDescriptor
  30. {
  31. /// <summary>The protection type</summary>
  32. public AipProtectionType ProtectionType { get; set; }
  33. /// <summary>Collection of users-to-roles mappings</summary>
  34. // public List<Microsoft.InformationProtection.UserRoles> UserRoles { get; set; }
  35. //
  36. // /// <summary>Collection of users-to-rights mappings</summary>
  37. // public List<Microsoft.InformationProtection.UserRights> UserRights { get; set; }
  38. /// <summary>
  39. /// The RMS template id for template protection, license id for adhoc protection, if any
  40. /// </summary>
  41. public string TemplateId { get; set; }
  42. /// <summary>
  43. /// Gets the Label info, if any
  44. /// This property will only be populated in ProtectionDescriptors for preexisting protected content. i.e. It is
  45. /// a field populated by the server at the moment protected content is consumed.
  46. /// </summary>
  47. public AipLabelInfo LabelInformation { get; set; }
  48. /// <summary>
  49. /// Gets the Label id, if any
  50. /// This property will only be populated in ProtectionDescriptors for preexisting protected content. i.e. It is
  51. /// a field populated by the server at the moment protected content is consumed.
  52. /// </summary>
  53. public string LabelId { get; set; }
  54. /// <summary>The owner of protection</summary>
  55. public string Owner { get; set; }
  56. /// <summary>
  57. /// Gets the content id
  58. /// Publishing licenses will have this identifier surrounded by curly braces "{}".
  59. /// Those braces are removed from the value returned here
  60. /// </summary>
  61. public string ContentId { get; set; }
  62. /// <summary>The protection name</summary>
  63. public string Name { get; set; }
  64. /// <summary>The protection description</summary>
  65. public string Description { get; set; }
  66. /// <summary>
  67. /// Whether or not protection allows offline content access (default = true)
  68. /// </summary>
  69. public bool AllowOfflineAccess { get; set; }
  70. /// <summary>Protection referrer address</summary>
  71. public string Referrer { get; set; }
  72. /// <summary>Protection expiration time</summary>
  73. public DateTime? ContentValidUntil { get; set; }
  74. /// <summary>App-specific data that was encrypted</summary>
  75. // public Dictionary<string, string> EncryptedAppData { get; set; }
  76. //
  77. // /// <summary>App-specific data that was signed</summary>
  78. // public Dictionary<string, string> SignedAppData { get; set; }
  79. /// <summary>The double key url</summary>
  80. public string DoubleKeyUrl { get; set; }
  81. }
  82. public class AipProtection
  83. {
  84. public AipProtectionDescriptor ProtectionDescriptor { get; set; }
  85. /// <summary>Email address of content owner</summary>
  86. public string Owner { get; set; }
  87. /// <summary>The user associated with the protection handler</summary>
  88. public string IssuedTo { get; set; }
  89. /// <summary>Whether or not the current user is the content owner</summary>
  90. public bool IsIssuedToOwner { get; set; }
  91. /// <summary>
  92. /// The unique identifier for the document/content
  93. /// Publishing licenses will have this identifier surrounded by curly braces "{}".
  94. /// Those braces are removed from the value returned here
  95. /// </summary>
  96. public string ContentId { get; set; }
  97. /// <summary> Whether or not protection handler uses deprecated crypto algorithms (ECB) for backward compatibility </summary>
  98. public bool UseDeprecatedAlgorithms { get; set; }
  99. /// <summary> Whether or not protection handler grants user 'audited extract' right </summary>
  100. public bool AuditedExtractAllowed { get; set; }
  101. /// <summary> The block size (in bytes) for the cipher mode used by this ProtectionHandler </summary>
  102. public long BlockSize { get; set; }
  103. }
  104. public class AipContentLabel
  105. {
  106. public AipLabel Label;
  107. public DateTime CreationTime { get; set; }
  108. /// <summary>The assignment method of the label.</summary>
  109. public AipAssignmentMethod AssignmentMethod { get; set; }
  110. /// <summary>Returns true if protection was applied by the label or not.</summary>
  111. public bool IsProtectionAppliedFromLabel { get; set; }
  112. }
  113. public class AipFileInfo
  114. {
  115. public AipContentLabel ContentLabel { get; set; }
  116. public AipProtection Protection { get; set; }
  117. public string OutputFileName { get; set; }
  118. }
  119. }