diff --git a/doc/manual/p11-kit.xml b/doc/manual/p11-kit.xml index 137bee1f..c58ba6af 100644 --- a/doc/manual/p11-kit.xml +++ b/doc/manual/p11-kit.xml @@ -293,7 +293,7 @@ $ p11-kit generate-keypair --type=algorithm {--bits=n|--curve=name} &l Specify the type of keys to generate. - Supported values are rsa, ecdsa and ed25519. + Supported values are rsa, ecdsa and eddsa. diff --git a/p11-kit/generate-keypair.c b/p11-kit/generate-keypair.c index 847d775d..2c164fdf 100644 --- a/p11-kit/generate-keypair.c +++ b/p11-kit/generate-keypair.c @@ -83,8 +83,7 @@ get_mechanism (const char *type) m.mechanism = CKM_RSA_PKCS_KEY_PAIR_GEN; else if (p11_ascii_strcaseeq (type, "ecdsa")) m.mechanism = CKM_ECDSA_KEY_PAIR_GEN; - else if (p11_ascii_strcaseeq (type, "ed25519") || - p11_ascii_strcaseeq (type, "ed448")) + else if (p11_ascii_strcaseeq (type, "eddsa")) m.mechanism = CKM_EC_EDWARDS_KEY_PAIR_GEN; return m; diff --git a/p11-kit/test-generate-keypair.sh b/p11-kit/test-generate-keypair.sh index 8371dfce..8fc36738 100755 --- a/p11-kit/test-generate-keypair.sh +++ b/p11-kit/test-generate-keypair.sh @@ -42,8 +42,8 @@ test_generate_keypair_ecdsa() { if "$abs_top_builddir"/p11-kit/p11-kit-testable generate-keypair --login --label="ecdsa-$curve" --type=ecdsa --curve="$curve" "pkcs11:token=PUBKEY%20LABEL?pin-value=booo" 2> err.out; then assert_fail "expected to fail: p11-kit generate-keypair" fi + assert_contains err.out "key-pair generation failed: The crypto mechanism is invalid or unrecognized" done - assert_contains err.out "key-pair generation failed: The crypto mechanism is invalid or unrecognized" if "$abs_top_builddir"/p11-kit/p11-kit-testable generate-keypair --login --label="ecdsa-unknown" --type=ecdsa --curve=unknown "pkcs11:token=PUBKEY%20LABEL?pin-value=booo" 2> err.out; then assert_fail "p11-kit generate-keypair succeeded for unknown ecdsa curve" @@ -54,16 +54,16 @@ test_generate_keypair_ecdsa() { test_generate_keypair_eddsa() { for curve in ed25519 ed448; do if "$abs_top_builddir"/p11-kit/p11-kit-testable generate-keypair --login --label="eddsa-$curve" --type=eddsa --curve="$curve" "pkcs11:token=PUBKEY%20LABEL?pin-value=booo" 2> err.out; then - assert_fail "unable to run: p11-kit generate-keypair" + assert_fail "expected to fail: p11-kit generate-keypair" fi + assert_contains err.out "key-pair generation failed: The crypto mechanism is invalid or unrecognized" done - assert_contains err.out "key-pair generation failed: The crypto mechanism is invalid or unrecognized" - if "$abs_top_builddir"/p11-kit/p11-kit-testable generate-keypair --login --label="eddsa-unknown" --type=eddsa --curve=unknown "pkcs11:token=PUBKEY%20LABEL?pin-value=booo"; then + if "$abs_top_builddir"/p11-kit/p11-kit-testable generate-keypair --login --label="eddsa-unknown" --type=eddsa --curve=unknown "pkcs11:token=PUBKEY%20LABEL?pin-value=booo" 2> err.out; then assert_fail "p11-kit generate-keypair succeeded for unknown eddsa curve" fi assert_contains err.out "unknown curve name: unknown" } run test_generate_keypair_mock test_generate_keypair_rsa \ - test_generate_keypair_ecdsa test_generate_keypair_ecdsa + test_generate_keypair_ecdsa test_generate_keypair_eddsa