You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

26 lines
532 B

  1. #!/usr/bin/env python
  2. import sys
  3. import pymacaroons
  4. if len(sys.argv) == 1:
  5. sys.stderr.write("usage: %s macaroon [key]\n" % (sys.argv[0],))
  6. sys.exit(1)
  7. macaroon_string = sys.argv[1]
  8. key = sys.argv[2] if len(sys.argv) > 2 else None
  9. macaroon = pymacaroons.Macaroon.deserialize(macaroon_string)
  10. print(macaroon.inspect())
  11. print("")
  12. verifier = pymacaroons.Verifier()
  13. verifier.satisfy_general(lambda c: True)
  14. try:
  15. verifier.verify(macaroon, key)
  16. print("Signature is correct")
  17. except Exception as e:
  18. print(str(e))