ClpCryptoLibTypes.pas 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  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. type
  19. PIInterface = ^IInterface;
  20. {$IFDEF FPC}
  21. PUInt64 = ^UInt64;
  22. {$ENDIF FPC}
  23. ECryptoLibException = class(Exception);
  24. EInvalidCastCryptoLibException = class(EInvalidCast);
  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. ENotSupportedCryptoLibException = class(ECryptoLibException);
  38. EEndOfStreamCryptoLibException = class(EIOCryptoLibException);
  39. EStreamOverflowCryptoLibException = class(ECryptoLibException);
  40. EAsn1CryptoLibException = class(ECryptoLibException);
  41. EAsn1ParsingCryptoLibException = class(ECryptoLibException);
  42. EInvalidKeyCryptoLibException = class(ECryptoLibException);
  43. EInvalidCipherTextCryptoLibException = class(ECryptoLibException);
  44. ESecurityUtilityCryptoLibException = class(ECryptoLibException);
  45. EAccessCryptoLibException = class(ECryptoLibException);
  46. EDataLengthCryptoLibException = class(ECryptoLibException);
  47. EOutputLengthCryptoLibException = class(ECryptoLibException);
  48. EBadBlockCryptoLibException = class(ECryptoLibException);
  49. /// <summary>
  50. /// Represents a dynamic array of Byte.
  51. /// </summary>
  52. TCryptoLibByteArray = TBytes;
  53. /// <summary>
  54. /// Represents a dynamic generic array of Type T.
  55. /// </summary>
  56. TCryptoLibGenericArray<T> = array of T;
  57. /// <summary>
  58. /// Represents a dynamic generic array of array of Type T.
  59. /// </summary>
  60. TCryptoLibMatrixGenericArray<T> = array of TCryptoLibGenericArray<T>;
  61. {$IFDEF DELPHIXE_UP}
  62. /// <summary>
  63. /// Represents a dynamic array of Boolean.
  64. /// </summary>
  65. TCryptoLibBooleanArray = TArray<Boolean>;
  66. /// <summary>
  67. /// Represents a dynamic array of ShortInt.
  68. /// </summary>
  69. TCryptoLibShortIntArray = TArray<ShortInt>;
  70. /// <summary>
  71. /// Represents a dynamic array of Int32.
  72. /// </summary>
  73. TCryptoLibInt32Array = TArray<Int32>;
  74. /// <summary>
  75. /// Represents a dynamic array of Int64.
  76. /// </summary>
  77. TCryptoLibInt64Array = TArray<Int64>;
  78. /// <summary>
  79. /// Represents a dynamic array of UInt32.
  80. /// </summary>
  81. TCryptoLibUInt32Array = TArray<UInt32>;
  82. /// <summary>
  83. /// Represents a dynamic array of UInt64.
  84. /// </summary>
  85. TCryptoLibUInt64Array = TArray<UInt64>;
  86. /// <summary>
  87. /// Represents a dynamic array of String.
  88. /// </summary>
  89. TCryptoLibStringArray = TArray<String>;
  90. /// <summary>
  91. /// Represents a dynamic array of Char.
  92. /// </summary>
  93. TCryptoLibCharArray = TArray<Char>;
  94. /// <summary>
  95. /// Represents a dynamic array of array of ShortInt.
  96. /// </summary>
  97. TCryptoLibMatrixShortIntArray = TArray<TCryptoLibShortIntArray>;
  98. /// <summary>
  99. /// Represents a dynamic array of array of byte.
  100. /// </summary>
  101. TCryptoLibMatrixByteArray = TArray<TCryptoLibByteArray>;
  102. /// <summary>
  103. /// Represents a dynamic array of array of Int32.
  104. /// </summary>
  105. TCryptoLibMatrixInt32Array = TArray<TCryptoLibInt32Array>;
  106. /// <summary>
  107. /// Represents a dynamic array of array of UInt32.
  108. /// </summary>
  109. TCryptoLibMatrixUInt32Array = TArray<TCryptoLibUInt32Array>;
  110. /// <summary>
  111. /// Represents a dynamic array of array of UInt64.
  112. /// </summary>
  113. TCryptoLibMatrixUInt64Array = TArray<TCryptoLibUInt64Array>;
  114. {$ELSE}
  115. /// <summary>
  116. /// Represents a dynamic array of Boolean.
  117. /// </summary>
  118. TCryptoLibBooleanArray = array of Boolean;
  119. /// <summary>
  120. /// Represents a dynamic array of ShortInt.
  121. /// </summary>
  122. TCryptoLibShortIntArray = array of ShortInt;
  123. /// <summary>
  124. /// Represents a dynamic array of Int32.
  125. /// </summary>
  126. TCryptoLibInt32Array = array of Int32;
  127. /// <summary>
  128. /// Represents a dynamic array of Int64.
  129. /// </summary>
  130. TCryptoLibInt64Array = array of Int64;
  131. /// <summary>
  132. /// Represents a dynamic array of UInt32.
  133. /// </summary>
  134. TCryptoLibUInt32Array = array of UInt32;
  135. /// <summary>
  136. /// Represents a dynamic array of UInt64.
  137. /// </summary>
  138. TCryptoLibUInt64Array = array of UInt64;
  139. /// <summary>
  140. /// Represents a dynamic array of String.
  141. /// </summary>
  142. TCryptoLibStringArray = array of String;
  143. /// <summary>
  144. /// Represents a dynamic array of Char.
  145. /// </summary>
  146. TCryptoLibCharArray = array of Char;
  147. /// <summary>
  148. /// Represents a dynamic array of array of ShortInt.
  149. /// </summary>
  150. TCryptoLibMatrixShortIntArray = array of TCryptoLibShortIntArray;
  151. /// <summary>
  152. /// Represents a dynamic array of array of byte.
  153. /// </summary>
  154. TCryptoLibMatrixByteArray = array of TCryptoLibByteArray;
  155. /// <summary>
  156. /// Represents a dynamic array of array of Int32.
  157. /// </summary>
  158. TCryptoLibMatrixInt32Array = array of TCryptoLibInt32Array;
  159. /// <summary>
  160. /// Represents a dynamic array of array of UInt32.
  161. /// </summary>
  162. TCryptoLibMatrixUInt32Array = array of TCryptoLibUInt32Array;
  163. /// <summary>
  164. /// Represents a dynamic array of array of UInt64.
  165. /// </summary>
  166. TCryptoLibMatrixUInt64Array = array of TCryptoLibUInt64Array;
  167. {$ENDIF DELPHIXE_UP}
  168. implementation
  169. {$IFDEF FPC}
  170. initialization
  171. // Set UTF-8 in AnsiStrings, just like Lazarus
  172. SetMultiByteConversionCodePage(CP_UTF8);
  173. // SetMultiByteFileSystemCodePage(CP_UTF8); not needed, this is the default under Windows
  174. SetMultiByteRTLFileSystemCodePage(CP_UTF8);
  175. {$ENDIF FPC}
  176. end.