Issues with RSA public key
- Dominant language
- Rust
- Stars
- 74
- Forks
- 23
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 3
Description
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
Contributor guide
Assessment
This issue has not been assessed yet.