Skip to content
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

KAS nano #7

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open

KAS nano #7

wants to merge 20 commits into from

Conversation

arkavo-com
Copy link

@arkavo-com arkavo-com commented Apr 28, 2024

  • some implementation of EC rewrap
  • removed some DPoP

Current error

Error code 2000. Final block decryption(aes-256-gcm) failed.error:000007D0:lib(0)::reason(2000)

Enhanced error logging in rewrap.go to help with debugging. In each error case, an error log is now added which gives more context about what caused the failure. In hsm.go, renamed the 'hkdf' variable to 'hkdfParams' for clarity and readability.
The logging statements in the "getEntityInfo" and "Rewrap" functions of rewrap.go have been updated for increased clarity and more detailed error tracking. This includes changing the level of some logs from 'warn' to 'error' when an issue arises while obtaining a token, and adding more context information to debug logs.
Added certificate caching mechanism to the PublicKey Provider to reduce the number of calls to the CryptoProvider. Now, before performing an expensive certificate generation operation, the system will first check if a cached certificate for the requested key exists. If it does, it returns the cached certificate, otherwise, it generates a new one and stores it in the cache for future requests.
This commitment enhances error handling and logging in various functions within hsm.go. Now, errors are clearly logged with slog.Error specifying the error type. Additionally, a sanity check has been added to the key pair generation process. Finally, a debug message is logged showing the length of the derived key during the symmetric key generation process.
A new mechanism for SHA256 has been added to the key pair generation process in the hsm.go file. A corresponding error logging has been implemented in case of failed verification. This is to improve the reliability of key pairs and add further security checks.
The key pair sanity check mechanism in the hsm.go file has been updated. Previously, it used the `CKM_SHA256` mechanism from the pkcs11 package, but now it is using the `CKM_ECDSA_SHA256` mechanism. This change helps to improve the security of the key pair verification process.
The ECDSA mechanism used in the sanity check of the key pair (in the hsm.go file) was updated from CKM_ECDSA_SHA256 to CKM_ECDSA. The aim of this change is to prevent potential issues related to signing.
The error logging in the PKCS11 VerifyASN1 method has been enhanced. Now it includes details such as the hash, the signature, and the EC Public Key when the verification fails.
Added extensive info for failed signature verification in the pkcs11 VerifyASN1 method. Logs now include the public key in PEM format, making error tracing easier and more effective.
The previously used sha256 to hash a string directly has been changed. Now, the Digest function of the pkcs11 context is used to hash the string. This method better suits the pkcs11 framework and may prevent possible errors.
Modified the execution flow in hsm.go to return errors immediately when RSA or EC key loads fail. Also, updated the initialization of pkcs11 digest and improved the error handling in the sanity check of the key pair.
Errors related to loading RSA key and verifying ASN1 signature are no longer returned immediately. Added a break statement after assigning a certificate to pair.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant