ClpCryptoLibTypes.pas 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. { *********************************************************************************** }
  2. { * CryptoLib Library * }
  3. { * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * }
  4. { * Github Repository <https://github.com/Xor-el> * }
  5. { * Distributed under the MIT software license, see the accompanying file LICENSE * }
  6. { * or visit http://www.opensource.org/licenses/mit-license.php. * }
  7. { * Acknowledgements: * }
  8. { * * }
  9. { * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * }
  10. { * development of this library * }
  11. { * ******************************************************************************* * }
  12. (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *)
  13. unit ClpCryptoLibTypes;
  14. {$I ..\Include\CryptoLib.inc}
  15. interface
  16. uses
  17. SysUtils,
  18. Generics.Collections;
  19. type
  20. PIInterface = ^IInterface;
  21. {$IFDEF FPC}
  22. PUInt64 = ^UInt64;
  23. {$ENDIF FPC}
  24. ECryptoLibException = class(Exception);
  25. EArithmeticCryptoLibException = class(ECryptoLibException);
  26. EInvalidOperationCryptoLibException = class(ECryptoLibException);
  27. EInvalidParameterCryptoLibException = class(ECryptoLibException);
  28. EIndexOutOfRangeCryptoLibException = class(ECryptoLibException);
  29. EArgumentCryptoLibException = class(ECryptoLibException);
  30. EArgumentNilCryptoLibException = class(ECryptoLibException);
  31. EArgumentOutOfRangeCryptoLibException = class(ECryptoLibException);
  32. ENullReferenceCryptoLibException = class(ECryptoLibException);
  33. EUnsupportedTypeCryptoLibException = class(ECryptoLibException);
  34. EIOCryptoLibException = class(ECryptoLibException);
  35. EFormatCryptoLibException = class(ECryptoLibException);
  36. ENotImplementedCryptoLibException = class(ECryptoLibException);
  37. EEndOfStreamCryptoLibException = class(ECryptoLibException);
  38. EStreamOverflowCryptoLibException = class(ECryptoLibException);
  39. EAsn1CryptoLibException = class(ECryptoLibException);
  40. EAsn1ParsingCryptoLibException = class(ECryptoLibException);
  41. EInvalidKeyCryptoLibException = class(ECryptoLibException);
  42. EInvalidCipherTextCryptoLibException = class(ECryptoLibException);
  43. ESecurityUtilityCryptoLibException = class(ECryptoLibException);
  44. EAccessCryptoLibException = class(ECryptoLibException);
  45. EDataLengthCryptoLibException = class(ECryptoLibException);
  46. EOutputLengthCryptoLibException = class(ECryptoLibException);
  47. EBadBlockCryptoLibException = class(ECryptoLibException);
  48. /// <summary>
  49. /// Represents a dynamic array of Byte.
  50. /// </summary>
  51. TCryptoLibByteArray = TBytes;
  52. /// <summary>
  53. /// Represents a dynamic generic array of Type T.
  54. /// </summary>
  55. TCryptoLibGenericArray<T> = array of T;
  56. /// <summary>
  57. /// Represents a dynamic generic array of array of Type T.
  58. /// </summary>
  59. TCryptoLibMatrixGenericArray<T> = array of TCryptoLibGenericArray<T>;
  60. {$IFDEF DELPHIXE_UP}
  61. /// <summary>
  62. /// Represents a dynamic array of Boolean.
  63. /// </summary>
  64. TCryptoLibBooleanArray = TArray<Boolean>;
  65. /// <summary>
  66. /// Represents a dynamic array of ShortInt.
  67. /// </summary>
  68. TCryptoLibShortIntArray = TArray<ShortInt>;
  69. /// <summary>
  70. /// Represents a dynamic array of Int32.
  71. /// </summary>
  72. TCryptoLibInt32Array = TArray<Int32>;
  73. /// <summary>
  74. /// Represents a dynamic array of Int64.
  75. /// </summary>
  76. TCryptoLibInt64Array = TArray<Int64>;
  77. /// <summary>
  78. /// Represents a dynamic array of UInt32.
  79. /// </summary>
  80. TCryptoLibUInt32Array = TArray<UInt32>;
  81. /// <summary>
  82. /// Represents a dynamic array of UInt64.
  83. /// </summary>
  84. TCryptoLibUInt64Array = TArray<UInt64>;
  85. /// <summary>
  86. /// Represents a dynamic array of String.
  87. /// </summary>
  88. TCryptoLibStringArray = TArray<String>;
  89. /// <summary>
  90. /// Represents a dynamic array of Char.
  91. /// </summary>
  92. TCryptoLibCharArray = TArray<Char>;
  93. /// <summary>
  94. /// Represents a dynamic array of array of ShortInt.
  95. /// </summary>
  96. TCryptoLibMatrixShortIntArray = TArray<TCryptoLibShortIntArray>;
  97. /// <summary>
  98. /// Represents a dynamic array of array of byte.
  99. /// </summary>
  100. TCryptoLibMatrixByteArray = TArray<TCryptoLibByteArray>;
  101. /// <summary>
  102. /// Represents a dynamic array of array of Int32.
  103. /// </summary>
  104. TCryptoLibMatrixInt32Array = TArray<TCryptoLibInt32Array>;
  105. /// <summary>
  106. /// Represents a dynamic array of array of UInt32.
  107. /// </summary>
  108. TCryptoLibMatrixUInt32Array = TArray<TCryptoLibUInt32Array>;
  109. /// <summary>
  110. /// Represents a dynamic array of array of UInt64.
  111. /// </summary>
  112. TCryptoLibMatrixUInt64Array = TArray<TCryptoLibUInt64Array>;
  113. {$ELSE}
  114. /// <summary>
  115. /// Represents a dynamic array of Boolean.
  116. /// </summary>
  117. TCryptoLibBooleanArray = array of Boolean;
  118. /// <summary>
  119. /// Represents a dynamic array of ShortInt.
  120. /// </summary>
  121. TCryptoLibShortIntArray = array of ShortInt;
  122. /// <summary>
  123. /// Represents a dynamic array of Int32.
  124. /// </summary>
  125. TCryptoLibInt32Array = array of Int32;
  126. /// <summary>
  127. /// Represents a dynamic array of Int64.
  128. /// </summary>
  129. TCryptoLibInt64Array = array of Int64;
  130. /// <summary>
  131. /// Represents a dynamic array of UInt32.
  132. /// </summary>
  133. TCryptoLibUInt32Array = array of UInt32;
  134. /// <summary>
  135. /// Represents a dynamic array of UInt64.
  136. /// </summary>
  137. TCryptoLibUInt64Array = array of UInt64;
  138. /// <summary>
  139. /// Represents a dynamic array of String.
  140. /// </summary>
  141. TCryptoLibStringArray = array of String;
  142. /// <summary>
  143. /// Represents a dynamic array of Char.
  144. /// </summary>
  145. TCryptoLibCharArray = array of Char;
  146. /// <summary>
  147. /// Represents a dynamic array of array of ShortInt.
  148. /// </summary>
  149. TCryptoLibMatrixShortIntArray = array of TCryptoLibShortIntArray;
  150. /// <summary>
  151. /// Represents a dynamic array of array of byte.
  152. /// </summary>
  153. TCryptoLibMatrixByteArray = array of TCryptoLibByteArray;
  154. /// <summary>
  155. /// Represents a dynamic array of array of Int32.
  156. /// </summary>
  157. TCryptoLibMatrixInt32Array = array of TCryptoLibInt32Array;
  158. /// <summary>
  159. /// Represents a dynamic array of array of UInt32.
  160. /// </summary>
  161. TCryptoLibMatrixUInt32Array = array of TCryptoLibUInt32Array;
  162. /// <summary>
  163. /// Represents a dynamic array of array of UInt64.
  164. /// </summary>
  165. TCryptoLibMatrixUInt64Array = array of TCryptoLibUInt64Array;
  166. {$ENDIF DELPHIXE_UP}
  167. implementation
  168. {$IFDEF FPC}
  169. initialization
  170. // Set UTF-8 in AnsiStrings, just like Lazarus
  171. SetMultiByteConversionCodePage(CP_UTF8);
  172. // SetMultiByteFileSystemCodePage(CP_UTF8); not needed, this is the default under Windows
  173. SetMultiByteRTLFileSystemCodePage(CP_UTF8);
  174. {$ENDIF FPC}
  175. end.