# Automatically selected ring dimension does not meet 128 bit security requirements

**URL:** https://openfhe.discourse.group/t/automatically-selected-ring-dimension-does-not-meet-128-bit-security-requirements/1643
**Category:** Library Questions
**Created:** [October 14, 2024, 9:03am UTC](https://openfhe.discourse.group/t/automatically-selected-ring-dimension-does-not-meet-128-bit-security-requirements/1643 "2024-10-14T09:03:29Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![nbruechmann](https://avatars.discourse-cdn.com/v4/letter/n/c37758/32.png) [@nbruechmann](https://openfhe.discourse.group/u/nbruechmann)
#### Post date: [October 14, 2024, 9:03am UTC](https://openfhe.discourse.group/t/automatically-selected-ring-dimension-does-not-meet-128-bit-security-requirements/1643/1 "2024-10-14T09:03:29Z")

</div>

I really wanted to have 23 levels available after bootstrapping, so I decided to set dcrtBits=56. When I then let openfhe automatically determine and set the ring dimension for 128 bit security, I get this exception:

ParamsGenCKKSRNS(): The ring dimension found using estimated logQ(P) [131072] does does not meet security requirements. Report this problem to OpenFHE developers and set the ring dimension manually to 262144.

Here is the modified simple-ckks-bootstrapping.cpp example, to reproduce the error:

```
void SimpleBootstrapExample() {

CCParams<CryptoContextCKKSRNS> parameters;

SecretKeyDist secretKeyDist = UNIFORM_TERNARY;
parameters.SetSecretKeyDist(secretKeyDist);

ScalingTechnique rescaleTech = FLEXIBLEAUTO;
usint dcrtBits = 56;
usint firstMod = 60;

parameters.SetScalingModSize(dcrtBits);
parameters.SetScalingTechnique(rescaleTech);
parameters.SetFirstModSize(firstMod);

std::vector<uint32_t> levelBudget = {4, 4};

uint32_t levelsAvailableAfterBootstrap = 23;
usint depth = levelsAvailableAfterBootstrap + FHECKKSRNS::GetBootstrapDepth(levelBudget, secretKeyDist);
parameters.SetMultiplicativeDepth(depth);

CryptoContext<DCRTPoly> cryptoContext = GenCryptoContext(parameters);
usint ringDim = cryptoContext->GetRingDimension();

std::cout << "CKKS scheme is using ring dimension " << ringDim << std::endl << std::endl;
}

```

I will use other values for now, but I thought you might be interested in the problem, since the error message tells me to report it.

---

<div class="post-metadata">

### Author: ![andreea.alexandru](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/andreea.alexandru/32/378_2.png) [@andreea.alexandru](https://openfhe.discourse.group/u/andreea.alexandru)
#### Post date: [October 15, 2024, 2:15pm UTC](https://openfhe.discourse.group/t/automatically-selected-ring-dimension-does-not-meet-128-bit-security-requirements/1643/2 "2024-10-15T14:15:06Z")

</div>

Thanks a lot for reporting it!
