Skip to content

Commit 71250c8

Browse files
committed
Patch #1 for 2.5
- OpenPGP: Fix RemoveCert loops - Fix infinite recursion in SubjectAltPublicKeyInfo.Algorithm - ML-DSA: fix PrivateKeyInfoFactory NPE
1 parent 17e7fa6 commit 71250c8

File tree

4 files changed

+24
-9
lines changed

4 files changed

+24
-9
lines changed

crypto/Readme.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ <h3><a class="mozTocH3" name="mozTocId685176"></a>Contents:<br /></h3>
3131
<li>
3232
<a href="#mozTocId3413">Notes:</a>
3333
<ol>
34+
<li>
35+
<a href="#mozTocId9020501">Release 2.5.1</a>
3436
<li>
3537
<a href="#mozTocId9020500">Release 2.5.0</a>
3638
<li>
@@ -335,6 +337,24 @@ <h3><a class="mozTocH3" name="mozTocId358608"></a>For first time users.</h3>
335337
<hr style="WIDTH: 100%; HEIGHT: 2px">
336338
<h3><a class="mozTocH3" name="mozTocId3413"></a>Notes:</h3>
337339

340+
<h4><a class="mozTocH4" name="mozTocId9020501"></a>Release 2.5.1, Friday Feb 7, 2025</h4>
341+
<h5>Defects Fixed</h5>
342+
<ul>
343+
<li>OpenPGP: Fixed RemoveCert loops in PgpPublicKey so that removals don't affect remaining iteration.</li>
344+
<li>Fix infinite recursion in SubjectAltPublicKeyInfo.Algorithm.</li>
345+
<li>ML-DSA: fix PrivateKeyInfoFactory NPE when no seed present.</li>
346+
</ul>
347+
<h5>Additional Features and Functionality</h5>
348+
<ul>
349+
</ul>
350+
<h5>Additional Notes</h5>
351+
<ul>
352+
<li>
353+
See the (cumulative) list of GitHub pull requests that we have accepted at
354+
<a href="https://github.com/bcgit/bc-csharp/pulls?q=is%3Apr+is%3Aclosed">bcgit/bc-csharp</a>.
355+
</li>
356+
</ul>
357+
338358
<h4><a class="mozTocH4" name="mozTocId9020500"></a>Release 2.5.0, Sunday December 1, 2024</h4>
339359
<h5>Defects Fixed</h5>
340360
<ul>

crypto/src/asn1/x509/SubjectAltPublicKeyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public SubjectAltPublicKeyInfo(SubjectPublicKeyInfo subjectPublicKeyInfo)
7777
m_subjectAltPublicKey = subjectPublicKeyInfo.PublicKey;
7878
}
7979

80-
public AlgorithmIdentifier Algorithm => Algorithm;
80+
public AlgorithmIdentifier Algorithm => m_algorithm;
8181

8282
public DerBitString SubjectAltPublicKey => m_subjectAltPublicKey;
8383

crypto/src/openpgp/PgpPublicKey.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,7 +1050,7 @@ private static PgpPublicKey RemoveCert(PgpPublicKey key, IUserDataPacket id)
10501050
PgpPublicKey returnKey = new PgpPublicKey(key);
10511051
bool found = false;
10521052

1053-
for (int i = 0; i < returnKey.ids.Count; i++)
1053+
for (int i = returnKey.ids.Count - 1; i >= 0; i--)
10541054
{
10551055
if (id.Equals(returnKey.ids[i]))
10561056
{
@@ -1100,7 +1100,7 @@ private static PgpPublicKey RemoveCert(PgpPublicKey key, IUserDataPacket id, Pgp
11001100
PgpPublicKey returnKey = new PgpPublicKey(key);
11011101
bool found = false;
11021102

1103-
for (int i = 0; i < returnKey.ids.Count; i++)
1103+
for (int i = returnKey.ids.Count - 1; i >= 0; i--)
11041104
{
11051105
if (id.Equals(returnKey.ids[i]))
11061106
{

crypto/src/pkcs/PrivateKeyInfoFactory.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -253,13 +253,8 @@ public static PrivateKeyInfo CreatePrivateKeyInfo(AsymmetricKeyParameter private
253253
if (seed != null)
254254
return PrivateKeyInfo.Create(algID, new DerOctetString(seed), attributes, publicKey: null);
255255

256+
// NOTE: The public key can be derived from the private key
256257
DerBitString publicKey = null;
257-
MLDsaPublicKeyParameters mlDsaPubKey = mlDsaKey.GetPublicKey();
258-
if (mlDsaPubKey != null)
259-
{
260-
// TODO[pqc] Avoid redundant copies?
261-
publicKey = new DerBitString(publicKey.GetEncoded());
262-
}
263258

264259
return PrivateKeyInfo.Create(algID, new DerOctetString(mlDsaKey.GetEncoded()), attributes, publicKey);
265260
}

0 commit comments

Comments
 (0)