Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

index.js 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. var test = require('tape')
  2. var fs = require('fs')
  3. var parseKey = require('../')
  4. var rsa1024 = {
  5. private: fs.readFileSync(__dirname + '/rsa.1024.priv'),
  6. public: fs.readFileSync(__dirname + '/rsa.1024.pub')
  7. }
  8. var rsa2028 = {
  9. private: fs.readFileSync(__dirname + '/rsa.2028.priv'),
  10. public: fs.readFileSync(__dirname + '/rsa.2028.pub')
  11. }
  12. var nonrsa1024 = {
  13. private: fs.readFileSync(__dirname + '/1024.priv'),
  14. public: fs.readFileSync(__dirname + '/1024.pub')
  15. }
  16. var pass1024 = {
  17. private: {
  18. passphrase: 'fooo',
  19. key: fs.readFileSync(__dirname + '/pass.1024.priv')
  20. },
  21. public: fs.readFileSync(__dirname + '/pass.1024.pub')
  22. }
  23. var ec = {
  24. private: fs.readFileSync(__dirname + '/ec.priv'),
  25. public: fs.readFileSync(__dirname + '/ec.pub')
  26. }
  27. var ecpass = {
  28. private: {
  29. key: fs.readFileSync(__dirname + '/ec.pass.priv'),
  30. passphrase: 'bard'
  31. },
  32. public: fs.readFileSync(__dirname + '/ec.pub')
  33. }
  34. var dsa = {
  35. private: fs.readFileSync(__dirname + '/dsa.1024.priv'),
  36. public: fs.readFileSync(__dirname + '/dsa.1024.pub')
  37. }
  38. var dsa2 = {
  39. private: fs.readFileSync(__dirname + '/dsa.2048.priv'),
  40. public: fs.readFileSync(__dirname + '/dsa.2048.pub')
  41. }
  42. var dsapass = {
  43. private: {
  44. key: fs.readFileSync(__dirname + '/pass.dsa.1024.priv'),
  45. passphrase: 'password'
  46. },
  47. public: fs.readFileSync(__dirname + '/pass.dsa.1024.pub')
  48. }
  49. var dsapass2 = {
  50. private: {
  51. key: fs.readFileSync(__dirname + '/pass2.dsa.1024.priv'),
  52. passphrase: 'password'
  53. },
  54. public: fs.readFileSync(__dirname + '/pass2.dsa.1024.pub')
  55. }
  56. var rsapass = {
  57. private: {
  58. key: fs.readFileSync(__dirname + '/pass.rsa.1024.priv'),
  59. passphrase: 'password'
  60. },
  61. public: fs.readFileSync(__dirname + '/pass.rsa.1024.pub')
  62. }
  63. var rsapass2 = {
  64. private: {
  65. key: fs.readFileSync(__dirname + '/pass.rsa.2028.priv'),
  66. passphrase: 'password'
  67. },
  68. public: fs.readFileSync(__dirname + '/pass.rsa.2028.pub')
  69. }
  70. var cert = {
  71. private: fs.readFileSync(__dirname + '/rsa.1024.priv'),
  72. public: fs.readFileSync(__dirname + '/node.cert')
  73. }
  74. var cert2 = {
  75. private: fs.readFileSync(__dirname + '/cert.priv'),
  76. public: fs.readFileSync(__dirname + '/cert.pub')
  77. }
  78. var i = 0
  79. function testIt (keys) {
  80. test('key ' + (++i), function (t) {
  81. t.plan(2)
  82. t.ok(parseKey(keys.public), 'public key')
  83. t.ok(parseKey(keys.private), 'private key')
  84. })
  85. }
  86. testIt(dsa)
  87. testIt(dsa2)
  88. testIt(rsa1024)
  89. testIt(ec)
  90. testIt(rsa2028)
  91. testIt(nonrsa1024)
  92. testIt(ecpass)
  93. testIt(dsapass)
  94. testIt(dsapass2)
  95. testIt(rsapass)
  96. testIt(rsapass2)
  97. testIt(pass1024)
  98. testIt(pass1024)
  99. testIt(cert)
  100. testIt(cert2)