<!-- canonical: https://0xsimao.com/findings/keyring-ii-verify-1024-bits-unsafe -->

# RsaVerifyOptimized sets the size of the key to 1024 bits, which is unsafe

Crit/High · Three Sigma · Zero-knowledge compliance · 10th July, 2024

Finding 3S-Keyring-M01 of the Keyring Credentials security review.

- Protocol: https://www.keyring.network/
- Report: /reports/keyring-ii
- Source: https://cdn.sanity.io/files/qoqld077/production/75b68b74f4b0dc6fbcd94892d934547d8259b57a.pdf

---

### Description

RSA signatures rely on the size of the key for higher safety assurances. As computational
power advances, it becomes possible to brute force signatures up to more bits. [This](https://www.rareskills.io/post/solidity-rsa-signatures-for-aidrops-and-presales-beating-ecdsa-and-merkle-trees-in-gas-efficiency) article
indicates keys up to 829 bits have been cracked, which is dangerously close to the
hardcoded 1024 bits.
The original RsaVerifyOptimized repository [recommends](https://github.com/adria0/SolRsaVerify/tree/master?tab=readme-ov-file#usage-with-openssl-openssl-311) setting a key size of at least 2048
bits.

### Recommendation

Update the key size to be 2048.

### Status

Addressed in [#02b0fa2](https://github.com/Keyring-Network/core-v2/commit/02b0fa29316ae970c4707dc7696fbc6ed5c6d9c5#diff-fb7295f993ba1bb3e38c525e603217eaf763c5e5515a40f365f1135404dbb8f4).
