istorage.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <?php
  2. /**
  3. * @author Björn Schießle <schiessle@owncloud.com>
  4. * @author Thomas Müller <thomas.mueller@tmit.eu>
  5. *
  6. * @copyright Copyright (c) 2015, ownCloud, Inc.
  7. * @license AGPL-3.0
  8. *
  9. * This code is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU Affero General Public License, version 3,
  11. * as published by the Free Software Foundation.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU Affero General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Affero General Public License, version 3,
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>
  20. *
  21. */
  22. namespace OCP\Encryption\Keys;
  23. interface IStorage {
  24. /**
  25. * get user specific key
  26. *
  27. * @param string $uid ID if the user for whom we want the key
  28. * @param string $keyId id of the key
  29. *
  30. * @return mixed key
  31. */
  32. public function getUserKey($uid, $keyId);
  33. /**
  34. * get file specific key
  35. *
  36. * @param string $path path to file
  37. * @param string $keyId id of the key
  38. *
  39. * @return mixed key
  40. */
  41. public function getFileKey($path, $keyId);
  42. /**
  43. * get system-wide encryption keys not related to a specific user,
  44. * e.g something like a key for public link shares
  45. *
  46. * @param string $keyId id of the key
  47. *
  48. * @return mixed key
  49. */
  50. public function getSystemUserKey($keyId);
  51. /**
  52. * set user specific key
  53. *
  54. * @param string $uid ID if the user for whom we want the key
  55. * @param string $keyId id of the key
  56. * @param mixed $key
  57. */
  58. public function setUserKey($uid, $keyId, $key);
  59. /**
  60. * set file specific key
  61. *
  62. * @param string $path path to file
  63. * @param string $keyId id of the key
  64. * @param boolean
  65. */
  66. public function setFileKey($path, $keyId, $key);
  67. /**
  68. * set system-wide encryption keys not related to a specific user,
  69. * e.g something like a key for public link shares
  70. *
  71. * @param string $keyId id of the key
  72. * @param mixed $key
  73. *
  74. * @return mixed key
  75. */
  76. public function setSystemUserKey($keyId, $key);
  77. /**
  78. * delete user specific key
  79. *
  80. * @param string $uid ID if the user for whom we want to delete the key
  81. * @param string $keyId id of the key
  82. *
  83. * @return boolean
  84. */
  85. public function deleteUserKey($uid, $keyId);
  86. /**
  87. * delete file specific key
  88. *
  89. * @param string $path path to file
  90. * @param string $keyId id of the key
  91. *
  92. * @return boolean
  93. */
  94. public function deleteFileKey($path, $keyId);
  95. /**
  96. * delete all file keys for a given file
  97. *
  98. * @param string $path to the file
  99. * @return boolean
  100. */
  101. public function deleteAllFileKeys($path);
  102. /**
  103. * delete system-wide encryption keys not related to a specific user,
  104. * e.g something like a key for public link shares
  105. *
  106. * @param string $keyId id of the key
  107. *
  108. * @return boolean
  109. */
  110. public function deleteSystemUserKey($keyId);
  111. /**
  112. * copy keys if a file was renamed
  113. *
  114. * @param string $source
  115. * @param string $target
  116. */
  117. public function renameKeys($source, $target);
  118. /**
  119. * move keys if a file was renamed
  120. *
  121. * @param string $source
  122. * @param string $target
  123. */
  124. public function copyKeys($source, $target);
  125. }