diff --git a/crypto/Readme.html b/crypto/Readme.html index 68d26523e7..3860ebeefe 100644 --- a/crypto/Readme.html +++ b/crypto/Readme.html @@ -31,6 +31,8 @@

Contents:

  • Notes:
      +
    1. + Release 2.5.1
    2. Release 2.5.0
    3. @@ -335,6 +337,24 @@

      For first time users.


      Notes:

      +

      Release 2.5.1, Friday Feb 7, 2025

      +
      Defects Fixed
      +
        +
      • OpenPGP: Fixed RemoveCert loops in PgpPublicKey so that removals don't affect remaining iteration.
      • +
      • Fix infinite recursion in SubjectAltPublicKeyInfo.Algorithm.
      • +
      • ML-DSA: fix PrivateKeyInfoFactory NPE when no seed present.
      • +
      +
      Additional Features and Functionality
      +
        +
      +
      Additional Notes
      +
        +
      • + See the (cumulative) list of GitHub pull requests that we have accepted at + bcgit/bc-csharp. +
      • +
      +

      Release 2.5.0, Sunday December 1, 2024

      Defects Fixed
        diff --git a/crypto/src/asn1/x509/SubjectAltPublicKeyInfo.cs b/crypto/src/asn1/x509/SubjectAltPublicKeyInfo.cs index fb69ae2077..7bf6d16a8e 100644 --- a/crypto/src/asn1/x509/SubjectAltPublicKeyInfo.cs +++ b/crypto/src/asn1/x509/SubjectAltPublicKeyInfo.cs @@ -77,7 +77,7 @@ public SubjectAltPublicKeyInfo(SubjectPublicKeyInfo subjectPublicKeyInfo) m_subjectAltPublicKey = subjectPublicKeyInfo.PublicKey; } - public AlgorithmIdentifier Algorithm => Algorithm; + public AlgorithmIdentifier Algorithm => m_algorithm; public DerBitString SubjectAltPublicKey => m_subjectAltPublicKey; diff --git a/crypto/src/openpgp/PgpPublicKey.cs b/crypto/src/openpgp/PgpPublicKey.cs index 672ce9548a..d3856d3e3c 100644 --- a/crypto/src/openpgp/PgpPublicKey.cs +++ b/crypto/src/openpgp/PgpPublicKey.cs @@ -1050,7 +1050,7 @@ private static PgpPublicKey RemoveCert(PgpPublicKey key, IUserDataPacket id) PgpPublicKey returnKey = new PgpPublicKey(key); bool found = false; - for (int i = 0; i < returnKey.ids.Count; i++) + for (int i = returnKey.ids.Count - 1; i >= 0; i--) { if (id.Equals(returnKey.ids[i])) { @@ -1100,7 +1100,7 @@ private static PgpPublicKey RemoveCert(PgpPublicKey key, IUserDataPacket id, Pgp PgpPublicKey returnKey = new PgpPublicKey(key); bool found = false; - for (int i = 0; i < returnKey.ids.Count; i++) + for (int i = returnKey.ids.Count - 1; i >= 0; i--) { if (id.Equals(returnKey.ids[i])) { diff --git a/crypto/src/pkcs/PrivateKeyInfoFactory.cs b/crypto/src/pkcs/PrivateKeyInfoFactory.cs index 6ebe9be756..776a96fe2f 100644 --- a/crypto/src/pkcs/PrivateKeyInfoFactory.cs +++ b/crypto/src/pkcs/PrivateKeyInfoFactory.cs @@ -253,13 +253,8 @@ public static PrivateKeyInfo CreatePrivateKeyInfo(AsymmetricKeyParameter private if (seed != null) return PrivateKeyInfo.Create(algID, new DerOctetString(seed), attributes, publicKey: null); + // NOTE: The public key can be derived from the private key DerBitString publicKey = null; - MLDsaPublicKeyParameters mlDsaPubKey = mlDsaKey.GetPublicKey(); - if (mlDsaPubKey != null) - { - // TODO[pqc] Avoid redundant copies? - publicKey = new DerBitString(publicKey.GetEncoded()); - } return PrivateKeyInfo.Create(algID, new DerOctetString(mlDsaKey.GetEncoded()), attributes, publicKey); }