-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for multiple certification scenarios and self-signing #248
Conversation
warn!( | ||
"An Edwards Keypair on curve 25519 should not be requested to perform \ | ||
ECDH. Creating anyway." | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the point of this message as it will appear in the server logs (if I am correct)? Is there a check in the ECDH operation to prevent this to happen? If yes I would remove this message. If no I would add it add still remove this message.
CryptographicAlgorithm::CoverCrypt => create_master_keypair( | ||
&Covercrypt::default(), | ||
private_key_uid, | ||
public_key_uid, | ||
Some(common_attributes), | ||
request.private_key_attributes, | ||
request.public_key_attributes, | ||
) | ||
.map_err(Into::into), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this bit behind a #[cfg(not(feature="fips"))]
?
I played with the CLI and tried to perform the different actions - here is my retex : Import
./target/debug/ckms certificates import /Users/celia-std/Documents/kms/crate/server/src/routes/google_cse/python/openssl/celia.corsin.p12
ERROR: failed parsing the object from the json file: invalid type: integer `0`, expected struct TTLV at line 1 column 1 manu: Let
❯ ./target/debug/ckms certificates import /Users/celia-std/Documents/kms/crate/server/src/routes/google_cse/python/openssl/celia.corsin.p12 -f pkcs12
ERROR: REST Request Failed: /kmip/2_1: Unexpected server error: error:11800071:PKCS12 routines:PKCS12_parse:mac verify failure:../crypto/pkcs12/p12_kiss.c:67: manu: Here is the new server response:
./target/debug/ckms certificates import /Users/celia-std/Documents/kms/crate/server/src/routes/google_cse/python/openssl/celia.corsin.p12 -f pkcs12 -p hello
ERROR: REST Request Failed: /kmip/2_1: Unexpected server error: error:0308010C:digital envelope routines:inner_evp_generic_fetch:unsupported:../crypto/evp/evp_fetch.c:349:Global default library context, Algorithm (RC2-40-CBC : 0), Properties () manu: I believe the Openssl library installed on your machine and required by the server is incorrect. Otherwise I could verified than macos server was correctly answering:
Certify
./target/debug/ckms certificates certify -g --subject-name celia --algorithm nist-p521
ERROR: Not Supported: subject name value missing for identifier celia manu: I've changed it into:
❯ ./target/debug/ckms certificates certify -p 050242ac-5276-4aad-bd25-fee5e905bdf3 -t celia_tag -s CN=celia
thread 'main' panicked at /Users/celia-std/Documents/kms/crate/cli/src/actions/certificates/certify.rs:367:14:
failed creating certificate: RequestFailed("/kmip/2_1: Unexpected server error: Invalid Certify request for object type SymmetricKey")
stack backtrace:
0: _rust_begin_unwind
1: core::panicking::panic_fmt
2: core::result::unwrap_failed
3: core::result::Result<T,E>::expect
4: cosmian_kms_cli::actions::certificates::certify::CertifyAction::run::{{closure}}
5: cosmian_kms_cli::actions::certificates::CertificatesCommands::process::{{closure}}
6: ckms::main_::{{closure}}
7: ckms::main::{{closure}}
8: tokio::runtime::park::CachedParkThread::block_on::{{closure}}
9: tokio::runtime::park::CachedParkThread::block_on
10: tokio::runtime::context::blocking::BlockingRegionGuard::block_on
11: tokio::runtime::scheduler::multi_thread::MultiThread::block_on::{{closure}}
12: tokio::runtime::context::runtime::enter_runtime
13: tokio::runtime::scheduler::multi_thread::MultiThread::block_on
14: tokio::runtime::runtime::Runtime::block_on
15: ckms::main
16: core::ops::function::FnOnce::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. manu: Replacing
❯ ./target/debug/ckms certificates certify -p ce7998f6-73a7-4374-aa45-c158643c3d0c -t celia_tag -s CN=celia
thread 'main' panicked at /Users/celia-std/Documents/kms/crate/cli/src/actions/certificates/certify.rs:367:14:
failed creating certificate: RequestFailed("/kmip/2_1: Unexpected server error: Invalid Certify request for object type PrivateKey")
stack backtrace:
0: _rust_begin_unwind
1: core::panicking::panic_fmt
2: core::result::unwrap_failed
3: core::result::Result<T,E>::expect
4: cosmian_kms_cli::actions::certificates::certify::CertifyAction::run::{{closure}}
5: cosmian_kms_cli::actions::certificates::CertificatesCommands::process::{{closure}}
6: ckms::main_::{{closure}}
7: ckms::main::{{closure}}
8: tokio::runtime::park::CachedParkThread::block_on::{{closure}}
9: tokio::runtime::park::CachedParkThread::block_on
10: tokio::runtime::context::blocking::BlockingRegionGuard::block_on
11: tokio::runtime::scheduler::multi_thread::MultiThread::block_on::{{closure}}
12: tokio::runtime::context::runtime::enter_runtime
13: tokio::runtime::scheduler::multi_thread::MultiThread::block_on
14: tokio::runtime::runtime::Runtime::block_on
15: ckms::main
16: core::ops::function::FnOnce::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. manu: Also fixed by replacing
❯ ./target/debug/ckms certificates certify -p 12ffb412-fba5-471c-b1ef-4658ccb8820c -t celia_tag -s CN=celia
thread 'main' panicked at /Users/celia-std/Documents/kms/crate/cli/src/actions/certificates/certify.rs:367:14:
failed creating certificate: RequestFailed("/kmip/2_1: Invalid Request: the cryptographic algorithm must be specified for key pair creation")
stack backtrace:
0: _rust_begin_unwind
1: core::panicking::panic_fmt
2: core::result::unwrap_failed
3: core::result::Result<T,E>::expect
4: cosmian_kms_cli::actions::certificates::certify::CertifyAction::run::{{closure}}
5: cosmian_kms_cli::actions::certificates::CertificatesCommands::process::{{closure}}
6: ckms::main_::{{closure}}
7: ckms::main::{{closure}}
8: tokio::runtime::park::CachedParkThread::block_on::{{closure}}
9: tokio::runtime::park::CachedParkThread::block_on
10: tokio::runtime::context::blocking::BlockingRegionGuard::block_on
11: tokio::runtime::scheduler::multi_thread::MultiThread::block_on::{{closure}}
12: tokio::runtime::context::runtime::enter_runtime
13: tokio::runtime::scheduler::multi_thread::MultiThread::block_on
14: tokio::runtime::runtime::Runtime::block_on
15: ckms::main
16: core::ops::function::FnOnce::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. manu: Same. Decrypt
[2024-05-30T08:11:24Z WARN cosmian_kms_server::routes] 422 Unprocessable Entity - Item_Not_Found: e8c6545a-24c7-47c3-aaf1-691894fdc5e5 manu: New error message:
Export
manu: Let us uniformize
manu: Replace the
ERROR: Get: REST Request Failed: /kmip/2_1: Item not found: e8c6545a-24c7-47c3-aaf1-691894fdc5e5 manu: New error message:
./target/debug/ckms certificates export -k e8c6545a-24c7-47c3-aaf1-691894fdc5e5 -f pem test
The certificate e8c6545a-24c7-47c3-aaf1-691894fdc5e5 of type Certificate was exported to "test" ./target/debug/ckms certificates export -k e8c6545a-24c7-47c3-aaf1-691894fdc5e5 -f pem -i test
The certificate e8c6545a-24c7-47c3-aaf1-691894fdc5e5 of type Certificate was exported to "test"
The attributes of the certificate e8c6545a-24c7-47c3-aaf1-691894fdc5e5 were exported to "test.attributes.json" manu: No strong opinion about this. The JSON file brings details about related objects (through links), I suppose there is no point for those links when the object is revoked Revoke❯ ./target/debug/ckms certificates revoke --help
Revoke a certificate.
When a certificate is revoked, it can only be exported by the owner of the certificate, using the --allow-revoked flag on the export function.
Usage: ckms certificates revoke [OPTIONS] <REVOCATION_REASON>
Arguments:
<REVOCATION_REASON>
The reason for the revocation as a string
Options:
-k, --certificate-id <CERTIFICATE_ID>
The certificate unique identifier of the certificate to revoke. If not specified, tags should be specified
-t, --tag <TAG>
Tag to use to retrieve the certificate when no certificate id is specified. To specify multiple tags, use the option multiple times
manu: Actually, you can revoke using only a tag
❯ ./target/debug/ckms certificates revoke -t celia_tag test
Successfully revoked the key: ["celia_tag"]. manu: Replaced
manu: Add an issue please Destroy
(RSA PUBLIC KEY)
(EC PUBLIC KEY)
manu: all fixed (same code used) Random
|
8d5b843
to
7872bfe
Compare
* fix: comment out the certificats validate tests * fix: comment out the certificats validate tests * fix: comment out the certificats validate tests
* fix: comment out the certificats validate tests * fix: comment out the certificats validate tests * fix: comment out the certificats validate tests
This is a complete rewrite of the Certify operation to extend its usage and support self-signing
There are now 4 possibilities for generating a certificate
using -certificate-signing-request
using -public-key-id-to-certify as well as a subject name
using -certificate-id-to-re-certify
using -generate-key-pair as well as a subject name and an algorithm
The signer (issuer) is specified by providing an issuer private key id
using -issuer-private-key-id and/or
an issuer certificate id using -issuer-certificate-id. If only
one of these parameters is specified, the other one will be inferred
from the links of the cryptographic object behind the provided parameter.
If no signer is provided, the certificate will be self-signed.
It is not possible to self-sign a CSR.