pubkey_speed.sh 906 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/bin/bash
  2. DIR=$(dirname `readlink -f $0`)
  3. function rsatest {
  4. echo -n " e=3 "; openssl genrsa -3 $1 2>/dev/null| $DIR/pubkey_speed "$2" rsa $3
  5. echo -n " e=f4 "; openssl genrsa -f4 $1 2>/dev/null| $DIR/pubkey_speed "$2" rsa $3
  6. }
  7. function rsatestall {
  8. echo "testing: $1"
  9. rsatest 512 "$1" 5000
  10. rsatest 768 "$1" 5000
  11. rsatest 1024 "$1" 1000
  12. rsatest 1536 "$1" 500
  13. rsatest 2048 "$1" 100
  14. rsatest 3072 "$1" 10
  15. rsatest 4096 "$1" 5
  16. rsatest 6144 "$1" 2
  17. rsatest 8192 "$1" 1
  18. }
  19. function ecdsatest {
  20. openssl ecparam -genkey -name $1 -noout | $DIR/pubkey_speed "$2" ecdsa $3
  21. }
  22. function ecdsatestall {
  23. echo "testing: $1"
  24. ecdsatest prime256v1 "$1" 4000
  25. ecdsatest secp384r1 "$1" 1000
  26. ecdsatest secp521r1 "$1" 500
  27. }
  28. rsatestall "gmp gcrypt pem pkcs1"
  29. rsatestall "gcrypt pem pkcs1"
  30. rsatestall "openssl pem"
  31. rsatestall "botan pem"
  32. ecdsatestall "openssl pem"
  33. ecdsatestall "botan pem"