rmpubkeyfromi2prmdb.rb 445 B

1234567891011121314151617181920212223242526272829303132
  1. require "gdbm"
  2. def delredkey db, key
  3. if db.has_key? key
  4. puts "Found redundant key: #{key}"
  5. db.delete key
  6. else
  7. puts "Do not found redundant key: #{key}"
  8. end
  9. end
  10. fn = nil
  11. if ARGV.length == 0
  12. fn = "i2prm.gdbm"
  13. else
  14. if File.exist? ARGV[0]
  15. fn = ARGV[0]
  16. else
  17. puts "Can not found \"#{ARGV[0]}\"."
  18. exit
  19. end
  20. end
  21. db = GDBM.new fn
  22. delredkey db, "keypair-pubkey"
  23. puts "Reorganize database"
  24. db.reorganize
  25. db.close