You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: blog/26-04-26/x509-certificates-in-js---encrypt-decrypt-data/x509-certificates-in-js---encrypt-decrypt-data.html
+31-9Lines changed: 31 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -115,9 +115,9 @@ <h1 slot=title class=title>
115
115
116
116
117
117
<divclass=blog-text>
118
-
<h4>
118
+
<h3>
119
119
notes :
120
-
</h4>
120
+
</h3>
121
121
<p>
122
122
private keys :
123
123
</p>
@@ -498,7 +498,9 @@ <h4>
498
498
499
499
500
500
<divclass=blog-text>
501
-
<h3>what size rsa keys do i need to encrypt an aes key of 256 bits</h3>
501
+
<h3class=blog-hdr>
502
+
what size rsa keys do i need to encrypt an aes key of 256 bits
503
+
</h3>
502
504
<p>To safely encrypt a 256-bit AES key using RSA, you should use an RSA key size of at least 2048 bits,
503
505
though 3072 bits or 4096 bits is highly recommended for modern applications requiring long-term security.</p>
504
506
<p>The reason for this requires looking at how RSA and AES work together, as well as the strict physical limits of RSA encryption.</p>
@@ -508,7 +510,9 @@ <h3>what size rsa keys do i need to encrypt an aes key of 256 bits</h3>
508
510
<p><strong>4096-bit RSA</strong> provides roughly <strong>140+ bits</strong> of effective security strength.</p>
509
511
<p>While mathematically a 3072-bit or 4096-bit RSA key is technically required to get closer to the massive security margin of a 256-bit AES key,
510
512
<strong>2048-bit is the absolute bare minimum</strong> allowed by modern cryptographic standards.</p>
511
-
<h2>Padding Overhead</h2>
513
+
<h4>
514
+
Padding Overhead
515
+
</h4>
512
516
<p>You can easily fit a 256-bit (32-byte) AES key into even the smallest standard RSA key size because of how RSA handles data.</p>
513
517
<p>An RSA key can only encrypt data that is smaller than its own modulus size, minus the required bytes for secure padding (like OAEP).</p>
514
518
<table>
@@ -553,7 +557,9 @@ <h2>Padding Overhead</h2>
553
557
</tbody>
554
558
</table>
555
559
<p>Even a 2048-bit RSA key gives you 190 bytes of payload space, which is more than enough room to slot your 32-byte AES key into.</p>
556
-
<h2>Recommendation</h2>
560
+
<h4>
561
+
Recommendation
562
+
</h4>
557
563
<p>Go with 3072-bit if you want the optimal balance between tight security and fast performance,
558
564
or 4096-bit if execution time isn't a bottleneck in your application and you want maximum security.
559
565
Avoid 2048-bit if you are designing a brand-new system from scratch.</p>
@@ -562,7 +568,11 @@ <h2>Recommendation</h2>
562
568
563
569
564
570
<divclass=blog-text>
565
-
<h3>how does iv length affect things? whats the deal with 96 bits</h3>
571
+
572
+
<h3class=blog-hdr>
573
+
how does iv length affect things? whats the deal with 96 bits
574
+
</h3>
575
+
566
576
<p>When dealing with encryption (specifically symmetric encryption like <strong>AES</strong>), the <strong>Initialization Vector (IV)</strong>
567
577
ensures that encrypting the exact same data twice results in two completely different ciphertexts.
568
578
This prevents attackers from spotting patterns in your data.</p>
@@ -586,17 +596,29 @@ <h4>Why 96 Bits (12 Bytes) is the Golden Number</h4>
0 commit comments