evpencod.txt 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. #
  2. # Copyright 2001-2017 The OpenSSL Project Authors. All Rights Reserved.
  3. #
  4. # Licensed under the Apache License 2.0 (the "License"). You may not use
  5. # this file except in compliance with the License. You can obtain a copy
  6. # in the file LICENSE in the source distribution or at
  7. # https://www.openssl.org/source/license.html
  8. # Tests start with one of these keywords
  9. # Cipher Decrypt Derive Digest Encoding KDF MAC PBE
  10. # PrivPubKeyPair Sign Verify VerifyRecover
  11. # and continue until a blank line. Lines starting with a pound sign,
  12. # like this prolog, are ignored.
  13. Title = Base64 tests
  14. Encoding = canonical
  15. Input = ""
  16. Output = ""
  17. Encoding = canonical
  18. Input = "h"
  19. Output = "aA==\n"
  20. Encoding = canonical
  21. Input = "hello"
  22. Output = "aGVsbG8=\n"
  23. Encoding = canonical
  24. Input = "hello world!"
  25. Output = "aGVsbG8gd29ybGQh\n"
  26. Encoding = canonical
  27. Input = 00010203040506070809a0b0c0d0e0f000
  28. Output = "AAECAwQFBgcICaCwwNDg8AA=\n"
  29. # Missing padding
  30. Encoding = invalid
  31. Output = "aGVsbG8"
  32. Encoding = invalid
  33. Output = "aGVsbG8\n"
  34. # Tolerate missing newline
  35. Encoding = valid
  36. Input = "hello"
  37. Output = "aGVsbG8="
  38. # Don't tolerate extra trailing '='
  39. Encoding = invalid
  40. Input = "hello"
  41. Output = "aGVsbG8==\n"
  42. Encoding = invalid
  43. Output = "aGVsbG8===\n"
  44. # Don't tolerate data after '='
  45. Encoding = invalid
  46. Output = "aGV=sbG8=\n"
  47. # Newlines are ignored
  48. Encoding = valid
  49. Input = "hello"
  50. Output = "aGV\nsbG8=\n"
  51. Encoding = canonical
  52. Input = "hello"
  53. Output = 614756736247383d0a
  54. # Invalid characters
  55. Encoding = invalid
  56. Output = 614756736247383d0a00
  57. Encoding = invalid
  58. Output = 61475600736247383d0a
  59. Encoding = invalid
  60. Output = 61475601736247383d0a
  61. Encoding = invalid
  62. Output = 61475680736247383d0a
  63. Encoding = invalid
  64. Output = e14756736247383d0a
  65. Encoding = canonical
  66. Input = "OpenSSLOpenSSL\n"
  67. Output = "T3BlblNTTE9wZW5TU0wK\n"
  68. Encoding = valid
  69. Input = "OpenSSLOpenSSL\n"
  70. Output = "T3BlblNTTE9wZW5TU0wK"
  71. # Truncate 1-3 chars
  72. Encoding = invalid
  73. Output = "T3BlblNTTE9wZW5TU0w"
  74. Encoding = invalid
  75. Output = "T3BlblNTTE9wZW5TU0"
  76. Encoding = invalid
  77. Output = "T3BlblNTTE9wZW5TU"
  78. Encoding = invalid
  79. Output = "T3BlblNTTE9wZW5TU0wK===="
  80. Encoding = invalid
  81. Output = "T3BlblNTTE9wZW5TU0wK============================================\n"
  82. Encoding = invalid
  83. Output = "YQ==YQ==YQ==\n"
  84. Encoding = invalid
  85. Output = "A"
  86. Encoding = invalid
  87. Output = "A\n"
  88. Encoding = invalid
  89. Output = "A="
  90. Encoding = invalid
  91. Output = "A==\n"
  92. Encoding = invalid
  93. Output = "A===\n"
  94. Encoding = invalid
  95. Output = "A====\n"
  96. Encoding = valid
  97. Input = "OpenSSLOpenSSL\n"
  98. Output = "T3BlblNTTE9wZW5TU0wK\n\n"
  99. Encoding = valid
  100. Input = "OpenSSLOpenSSL\n"
  101. Output = "T3BlblNTTE\n9wZW5TU0wK"
  102. # CVE 2015-0292
  103. Encoding = invalid
  104. Output = "ZW5jb2RlIG1lCg==================================================================\n"
  105. Encoding = canonical
  106. Input = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  107. Output = "eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eA==\n"
  108. Encoding = valid
  109. Input = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  110. Output = "eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eA\n==\n"
  111. Encoding = valid
  112. Input = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  113. Output = "eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eA=\n=\n"
  114. Encoding = invalid
  115. Output = "eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eA====\n"
  116. # Multiline output without padding
  117. Encoding = canonical
  118. Input = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  119. Output = "eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4\neHh4eHh4eHh4eHh4\n"
  120. # Multiline output with padding
  121. Encoding = canonical
  122. Input = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  123. Output = "eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4\neHh4eHh4eHh4eHh4eHh4eA==\n"
  124. # Multiline output with line break in the middle of a b64 block is accepted
  125. Encoding = valid
  126. Input = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  127. Output = "eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh\n4eHh4eHh4eHh4eHh4eHh4eA==\n"
  128. # Long lines are accepted
  129. Encoding = valid
  130. Input = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  131. Output = "eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eA==\n"
  132. # Multiline input with data after '='.
  133. Encoding = invalid
  134. Output = "eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eA==\neHh4eHh4eHh4eHh4eHh4eHh4\n"
  135. Encoding = invalid
  136. Output = "eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4\neA==eHh4eHh4eHh4eHh4eHh4\n"
  137. # B64_EOF ('-') terminates input and trailing bytes are ignored
  138. Encoding = valid
  139. Input = "OpenSSLOpenSSL\n"
  140. Output = "T3BlblNTTE9wZW5TU0wK\n-abcd"
  141. Encoding = valid
  142. Input = "OpenSSLOpenSSL\n"
  143. Output = "T3BlblNTTE9wZW5TU0wK-abcd"