Issues with RSA public key

Aperta
#445 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
gcp, rust

Direzione di ricerca

Inizia con attributes.rs e la conversione della chiave pubblica RSA mostrata nel report, quindi riproduci gli avvisi con pkcs11-tool rispetto al modulo GCP KMS. Traccia C_GetAttributeValue insieme a C_GetFunctionList e agli altri punti di ingresso C_* menzionati; il lavoro è completato quando si determina se gli attributi richiesti e i punti di ingresso necessari sono supportati e si interviene sul comportamento segnalato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Hi,

Thank yoy soo much for your time spent on this project, looking forward exploring it some more.

I had a quick question regarding the use of this library and it's something I've been struggeling with for a while now.

        let rsa_pub = RsaPublicKey::from_public_key_pem(&response.pem)
            .map_err(|e| format!("RSA PEM parse error: {:?}", e))
            .unwrap();

        let pkcs1_der_document = rsa_pub
            .to_pkcs1_der()
            .map_err(|e| anyhow::anyhow!("PKCS#1 DER encode error: {}", e))?;

        let result = KSMPublicKey {
            id: Sha256::digest(response.name.as_bytes()).to_vec(),
            label: response.name,
            algorithm: KeyAlgorithm::Rsa,
            der: pkcs1_der_document.into_vec(),
        };

Is this correct?

Getting weird error message when using pkcs11-tool

warning: PKCS11 function C_GetAttributeValue(MODULUS_BITS) failed: rv = CKR_ATTRIBUTE_TYPE_INVALID (0x12)
warning: PKCS11 function C_GetAttributeValue(ENCRYPT) failed: rv = CKR_ATTRIBUTE_TYPE_INVALID (0x12)
warning: PKCS11 function C_GetAttributeValue(VERIFY) failed: rv = CKR_ATTRIBUTE_TYPE_INVALID (0x12)
warning: PKCS11 function C_GetAttributeValue(VERIFY_RECOVER) failed: rv = CKR_ATTRIBUTE_TYPE_INVALID (0x12)
warning: PKCS11 function C_GetAttributeValue(WRAP) failed: rv = CKR_ATTRIBUTE_TYPE_INVALID (0x12)

Based on the info I can see in the attributes.rs file these values should be injected automatically but maybe I'm missing something?

Should I also implement any more C_* functions other than C_GetFunctionList ?

Currently building a GCP KMS module that is mostly working but there are still some weird edge cases I need to solve.

Thank you

Lingua principale
Rust
Stelle
75
Fork
25
Merge medio
14h 16m
PR unite (30g)
1

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di google/native-pkcs11

Tutte le issue di google/native-pkcs11

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.