summary refs log tree commit diff
path: root/crypto/src/pkcs/Pkcs12Store.cs
diff options
context:
space:
mode:
authorDavid Hook <dgh@cryptoworkshop.com>2021-08-30 15:58:25 +1000
committerDavid Hook <dgh@cryptoworkshop.com>2021-08-30 15:58:25 +1000
commitdb93ba92fdc095c23edaf547f2a42cfc511c037f (patch)
tree16b09df8254695485988ff0a00d8a88896ceb143 /crypto/src/pkcs/Pkcs12Store.cs
parentAdd missing GetHashCode variant (diff)
downloadBouncyCastle.NET-ed25519-db93ba92fdc095c23edaf547f2a42cfc511c037f.tar.xz
initial fix for #261
Diffstat (limited to 'crypto/src/pkcs/Pkcs12Store.cs')
-rw-r--r--crypto/src/pkcs/Pkcs12Store.cs10
1 files changed, 10 insertions, 0 deletions
diff --git a/crypto/src/pkcs/Pkcs12Store.cs b/crypto/src/pkcs/Pkcs12Store.cs
index dba76cdb5..d71fbe862 100644
--- a/crypto/src/pkcs/Pkcs12Store.cs
+++ b/crypto/src/pkcs/Pkcs12Store.cs
@@ -361,6 +361,16 @@ namespace Org.BouncyCastle.Pkcs
                             // the same OID - currently, differing values give an error
                             if (attributes.Contains(aOid.Id))
                             {
+                                // we've found more than one - one might be incorrect
+                                if (aOid.Equals(PkcsObjectIdentifiers.Pkcs9AtLocalKeyID))
+                                {
+                                    String id = Hex.ToHexString(Asn1OctetString.GetInstance(attr).GetOctets());
+                                    if (!(keys.Keys[id] != null || localIds.Keys[id] != null))
+                                    {
+                                        continue; // ignore this one - it's not valid
+                                    }
+                                }
+
                                 // OK, but the value has to be the same
                                 if (!attributes[aOid.Id].Equals(attr))
                                 {