summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--crypto/src/asn1/x509/AuthorityKeyIdentifier.cs2
-rw-r--r--crypto/src/asn1/x509/SubjectAltPublicKeyInfo.cs4
-rw-r--r--crypto/src/asn1/x509/SubjectKeyIdentifier.cs2
-rw-r--r--crypto/src/asn1/x509/SubjectPublicKeyInfo.cs45
-rw-r--r--crypto/src/cms/CMSEnvelopedGenerator.cs13
-rw-r--r--crypto/src/cms/KeyAgreeRecipientInfoGenerator.cs2
-rw-r--r--crypto/src/crypto/operators/Asn1KeyWrapper.cs14
-rw-r--r--crypto/src/ocsp/CertificateID.cs2
-rw-r--r--crypto/src/ocsp/RespID.cs2
-rw-r--r--crypto/src/pkix/PkixCertPathValidatorUtilities.cs25
-rw-r--r--crypto/src/pqc/crypto/utils/PqcPublicKeyFactory.cs31
-rw-r--r--crypto/src/security/PublicKeyFactory.cs8
-rw-r--r--crypto/src/tls/crypto/impl/bc/BcTlsRawKeyCertificate.cs6
-rw-r--r--crypto/src/x509/store/X509CertStoreSelector.cs2
14 files changed, 84 insertions, 74 deletions
diff --git a/crypto/src/asn1/x509/AuthorityKeyIdentifier.cs b/crypto/src/asn1/x509/AuthorityKeyIdentifier.cs
index 810fda82e..9d1b332d7 100644
--- a/crypto/src/asn1/x509/AuthorityKeyIdentifier.cs
+++ b/crypto/src/asn1/x509/AuthorityKeyIdentifier.cs
@@ -103,7 +103,7 @@ namespace Org.BouncyCastle.Asn1.X509
         {
             IDigest digest = new Sha1Digest();
             byte[] resBuf = new byte[digest.GetDigestSize()];
-			byte[] bytes = spki.PublicKeyData.GetBytes();
+			byte[] bytes = spki.PublicKey.GetBytes();
             digest.BlockUpdate(bytes, 0, bytes.Length);
             digest.DoFinal(resBuf, 0);
 
diff --git a/crypto/src/asn1/x509/SubjectAltPublicKeyInfo.cs b/crypto/src/asn1/x509/SubjectAltPublicKeyInfo.cs
index 4fe165898..1589dae70 100644
--- a/crypto/src/asn1/x509/SubjectAltPublicKeyInfo.cs
+++ b/crypto/src/asn1/x509/SubjectAltPublicKeyInfo.cs
@@ -68,8 +68,8 @@ namespace Org.BouncyCastle.Asn1.X509
 
         public SubjectAltPublicKeyInfo(SubjectPublicKeyInfo subjectPublicKeyInfo)
         {
-            m_algorithm = subjectPublicKeyInfo.AlgorithmID;
-            m_subjectAltPublicKey = subjectPublicKeyInfo.PublicKeyData;
+            m_algorithm = subjectPublicKeyInfo.Algorithm;
+            m_subjectAltPublicKey = subjectPublicKeyInfo.PublicKey;
         }
 
         public AlgorithmIdentifier Algorithm => Algorithm;
diff --git a/crypto/src/asn1/x509/SubjectKeyIdentifier.cs b/crypto/src/asn1/x509/SubjectKeyIdentifier.cs
index bb694681b..d8a78b7c3 100644
--- a/crypto/src/asn1/x509/SubjectKeyIdentifier.cs
+++ b/crypto/src/asn1/x509/SubjectKeyIdentifier.cs
@@ -123,7 +123,7 @@ namespace Org.BouncyCastle.Asn1.X509
             IDigest digest = new Sha1Digest();
             byte[] resBuf = new byte[digest.GetDigestSize()];
 
-			byte[] bytes = spki.PublicKeyData.GetBytes();
+			byte[] bytes = spki.PublicKey.GetBytes();
             digest.BlockUpdate(bytes, 0, bytes.Length);
             digest.DoFinal(resBuf, 0);
             return resBuf;
diff --git a/crypto/src/asn1/x509/SubjectPublicKeyInfo.cs b/crypto/src/asn1/x509/SubjectPublicKeyInfo.cs
index 5faab82d0..fa1fda4ab 100644
--- a/crypto/src/asn1/x509/SubjectPublicKeyInfo.cs
+++ b/crypto/src/asn1/x509/SubjectPublicKeyInfo.cs
@@ -25,32 +25,32 @@ namespace Org.BouncyCastle.Asn1.X509
             return new SubjectPublicKeyInfo(Asn1Sequence.GetInstance(obj, explicitly));
         }
 
-        private readonly AlgorithmIdentifier m_algID;
-        private readonly DerBitString m_keyData;
+        private readonly AlgorithmIdentifier m_algorithm;
+        private readonly DerBitString m_publicKey;
 
         public SubjectPublicKeyInfo(AlgorithmIdentifier algID, DerBitString publicKey)
         {
-            m_algID = algID;
-            m_keyData = publicKey;
+            m_algorithm = algID;
+            m_publicKey = publicKey;
         }
 
         public SubjectPublicKeyInfo(AlgorithmIdentifier algID, Asn1Encodable publicKey)
         {
-            m_algID = algID;
-            m_keyData = new DerBitString(publicKey);
+            m_algorithm = algID;
+            m_publicKey = new DerBitString(publicKey);
         }
 
         public SubjectPublicKeyInfo(AlgorithmIdentifier algID, byte[] publicKey)
         {
-            m_algID = algID;
-            m_keyData = new DerBitString(publicKey);
+            m_algorithm = algID;
+            m_publicKey = new DerBitString(publicKey);
         }
 
 #if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER
         public SubjectPublicKeyInfo(AlgorithmIdentifier algID, ReadOnlySpan<byte> publicKey)
         {
-            m_algID = algID;
-            m_keyData = new DerBitString(publicKey);
+            m_algorithm = algID;
+            m_publicKey = new DerBitString(publicKey);
         }
 #endif
 
@@ -59,11 +59,14 @@ namespace Org.BouncyCastle.Asn1.X509
             if (seq.Count != 2)
 				throw new ArgumentException("Bad sequence size: " + seq.Count, "seq");
 
-            m_algID = AlgorithmIdentifier.GetInstance(seq[0]);
-			m_keyData = DerBitString.GetInstance(seq[1]);
+            m_algorithm = AlgorithmIdentifier.GetInstance(seq[0]);
+			m_publicKey = DerBitString.GetInstance(seq[1]);
 		}
 
-        public AlgorithmIdentifier AlgorithmID => m_algID;
+        public AlgorithmIdentifier Algorithm => m_algorithm;
+
+        [Obsolete("Use 'Algorithm' instead")]
+        public AlgorithmIdentifier AlgorithmID => m_algorithm;
 
         /**
          * for when the public key is an encoded object - if the bitstring
@@ -72,14 +75,16 @@ namespace Org.BouncyCastle.Asn1.X509
          * @exception IOException - if the bit string doesn't represent a Der
          * encoded object.
          */
-        public Asn1Object ParsePublicKey() => Asn1Object.FromByteArray(m_keyData.GetOctets());
+        public Asn1Object ParsePublicKey() => Asn1Object.FromByteArray(m_publicKey.GetOctets());
 
-        /**
-         * for when the public key is raw bits...
-         */
-        public DerBitString PublicKeyData => m_keyData;
+        /// <summary>Return the public key as a raw bit string.</summary>
+        public DerBitString PublicKey => m_publicKey;
 
-		/**
+        /// <summary>Return the public key as a raw bit string.</summary>
+        [Obsolete("Use 'PublicKey' instead")]
+        public DerBitString PublicKeyData => m_publicKey;
+
+        /**
          * Produce an object suitable for an Asn1OutputStream.
          * <pre>
          * SubjectPublicKeyInfo ::= Sequence {
@@ -87,6 +92,6 @@ namespace Org.BouncyCastle.Asn1.X509
          *                          publicKey BIT STRING }
          * </pre>
          */
-        public override Asn1Object ToAsn1Object() => new DerSequence(m_algID, m_keyData);
+        public override Asn1Object ToAsn1Object() => new DerSequence(m_algorithm, m_publicKey);
     }
 }
diff --git a/crypto/src/cms/CMSEnvelopedGenerator.cs b/crypto/src/cms/CMSEnvelopedGenerator.cs
index 401f4d2e8..9830cefcc 100644
--- a/crypto/src/cms/CMSEnvelopedGenerator.cs
+++ b/crypto/src/cms/CMSEnvelopedGenerator.cs
@@ -139,12 +139,12 @@ namespace Org.BouncyCastle.Cms
 		 * @param cert recipient's public key certificate
 		 * @exception ArgumentException if there is a problem with the certificate
 		 */
-		public void AddKeyTransRecipient(
-			X509Certificate cert)
+		public void AddKeyTransRecipient(X509Certificate cert)
 		{
 			TbsCertificateStructure recipientTbsCert = CmsUtilities.GetTbsCertificateStructure(cert);
 			SubjectPublicKeyInfo info = recipientTbsCert.SubjectPublicKeyInfo;
-			this.AddRecipientInfoGenerator(new KeyTransRecipientInfoGenerator(cert, new Asn1KeyWrapper(info.AlgorithmID.Algorithm, info.AlgorithmID.Parameters, cert)));
+			AddRecipientInfoGenerator(
+				new KeyTransRecipientInfoGenerator(cert, new Asn1KeyWrapper(info.Algorithm, cert)));
 		}
 
 		/**
@@ -154,12 +154,11 @@ namespace Org.BouncyCastle.Cms
 		* @param subKeyId the identifier for the recipient's public key
 		* @exception ArgumentException if there is a problem with the key
 		*/
-		public void AddKeyTransRecipient(
-			AsymmetricKeyParameter	pubKey,
-			byte[]					subKeyId)
+		public void AddKeyTransRecipient(AsymmetricKeyParameter pubKey, byte[] subKeyId)
 		{
 			SubjectPublicKeyInfo info = SubjectPublicKeyInfoFactory.CreateSubjectPublicKeyInfo(pubKey);
-			this.AddRecipientInfoGenerator(new KeyTransRecipientInfoGenerator(subKeyId, new Asn1KeyWrapper(info.AlgorithmID.Algorithm, info.AlgorithmID.Parameters, pubKey)));
+			AddRecipientInfoGenerator(
+				new KeyTransRecipientInfoGenerator(subKeyId, new Asn1KeyWrapper(info.Algorithm, pubKey)));
 		}
 
 		/**
diff --git a/crypto/src/cms/KeyAgreeRecipientInfoGenerator.cs b/crypto/src/cms/KeyAgreeRecipientInfoGenerator.cs
index 97fbd115b..ab7c1a0bd 100644
--- a/crypto/src/cms/KeyAgreeRecipientInfoGenerator.cs
+++ b/crypto/src/cms/KeyAgreeRecipientInfoGenerator.cs
@@ -150,6 +150,6 @@ namespace Org.BouncyCastle.Cms
 			CreateOriginatorPublicKey(SubjectPublicKeyInfoFactory.CreateSubjectPublicKeyInfo(publicKey));
 
         private static OriginatorPublicKey CreateOriginatorPublicKey(SubjectPublicKeyInfo originatorKeyInfo) =>
-			new OriginatorPublicKey(originatorKeyInfo.AlgorithmID, originatorKeyInfo.PublicKeyData);
+			new OriginatorPublicKey(originatorKeyInfo.Algorithm, originatorKeyInfo.PublicKey);
     }
 }
diff --git a/crypto/src/crypto/operators/Asn1KeyWrapper.cs b/crypto/src/crypto/operators/Asn1KeyWrapper.cs
index 9e7bffae7..440c1502a 100644
--- a/crypto/src/crypto/operators/Asn1KeyWrapper.cs
+++ b/crypto/src/crypto/operators/Asn1KeyWrapper.cs
@@ -26,7 +26,7 @@ namespace Org.BouncyCastle.Crypto.Operators
         }
 
         public Asn1KeyWrapper(DerObjectIdentifier algorithm, X509Certificate cert)
-             : this(algorithm, cert.GetPublicKey())
+             : this(algorithm, null, cert.GetPublicKey())
         {
         }
 
@@ -35,8 +35,18 @@ namespace Org.BouncyCastle.Crypto.Operators
         {
         }
 
+        public Asn1KeyWrapper(AlgorithmIdentifier algorithm, X509Certificate cert)
+            : this(algorithm.Algorithm, algorithm.Parameters, cert.GetPublicKey())
+        {
+        }
+
         public Asn1KeyWrapper(DerObjectIdentifier algorithm, Asn1Encodable parameters, X509Certificate cert)
-            :this(algorithm, parameters, cert.GetPublicKey())
+            : this(algorithm, parameters, cert.GetPublicKey())
+        {
+        }
+
+        public Asn1KeyWrapper(AlgorithmIdentifier algorithm, ICipherParameters key)
+            : this(algorithm.Algorithm, algorithm.Parameters, key)
         {
         }
 
diff --git a/crypto/src/ocsp/CertificateID.cs b/crypto/src/ocsp/CertificateID.cs
index 215857ae9..b972a0f66 100644
--- a/crypto/src/ocsp/CertificateID.cs
+++ b/crypto/src/ocsp/CertificateID.cs
@@ -127,7 +127,7 @@ namespace Org.BouncyCastle.Ocsp
 				AsymmetricKeyParameter issuerKey = issuerCert.GetPublicKey();
 				SubjectPublicKeyInfo info = SubjectPublicKeyInfoFactory.CreateSubjectPublicKeyInfo(issuerKey);
 				byte[] issuerKeyHash = DigestUtilities.CalculateDigest(
-					hashAlgorithm, info.PublicKeyData.GetBytes());
+					hashAlgorithm, info.PublicKey.GetBytes());
 
 				return new CertID(hashAlg, new DerOctetString(issuerNameHash),
 					new DerOctetString(issuerKeyHash), serialNumber);
diff --git a/crypto/src/ocsp/RespID.cs b/crypto/src/ocsp/RespID.cs
index 3238b26da..304b9cd49 100644
--- a/crypto/src/ocsp/RespID.cs
+++ b/crypto/src/ocsp/RespID.cs
@@ -35,7 +35,7 @@ namespace Org.BouncyCastle.Ocsp
 			{
 				SubjectPublicKeyInfo info = SubjectPublicKeyInfoFactory.CreateSubjectPublicKeyInfo(publicKey);
 
-				byte[] keyHash = DigestUtilities.CalculateDigest("SHA1", info.PublicKeyData.GetBytes());
+				byte[] keyHash = DigestUtilities.CalculateDigest("SHA1", info.PublicKey.GetBytes());
 
 				this.id = new ResponderID(new DerOctetString(keyHash));
 			}
diff --git a/crypto/src/pkix/PkixCertPathValidatorUtilities.cs b/crypto/src/pkix/PkixCertPathValidatorUtilities.cs
index 8d615b488..32b00503e 100644
--- a/crypto/src/pkix/PkixCertPathValidatorUtilities.cs
+++ b/crypto/src/pkix/PkixCertPathValidatorUtilities.cs
@@ -210,20 +210,17 @@ namespace Org.BouncyCastle.Pkix
 			return cert.SubjectDN.Equivalent(cert.IssuerDN, true);
 		}
 
-		internal static AlgorithmIdentifier GetAlgorithmIdentifier(
-			AsymmetricKeyParameter key)
-		{
-			try
-			{
-				SubjectPublicKeyInfo info = SubjectPublicKeyInfoFactory.CreateSubjectPublicKeyInfo(key);
-
-				return info.AlgorithmID;
-			}
-			catch (Exception e)
-			{
-				throw new PkixCertPathValidatorException("Subject public key cannot be decoded.", e);
-			}
-		}
+        internal static AlgorithmIdentifier GetAlgorithmIdentifier(AsymmetricKeyParameter key)
+        {
+            try
+            {
+                return SubjectPublicKeyInfoFactory.CreateSubjectPublicKeyInfo(key).Algorithm;
+            }
+            catch (Exception e)
+            {
+                throw new PkixCertPathValidatorException("Subject public key cannot be decoded.", e);
+            }
+        }
 
 		internal static bool IsAnyPolicy(ISet<string> policySet)
 		{
diff --git a/crypto/src/pqc/crypto/utils/PqcPublicKeyFactory.cs b/crypto/src/pqc/crypto/utils/PqcPublicKeyFactory.cs
index cb0bffb70..146827034 100644
--- a/crypto/src/pqc/crypto/utils/PqcPublicKeyFactory.cs
+++ b/crypto/src/pqc/crypto/utils/PqcPublicKeyFactory.cs
@@ -178,8 +178,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Utilities
         /// <exception cref="IOException"> on an error decoding the key</exception>
         public static AsymmetricKeyParameter CreateKey(SubjectPublicKeyInfo keyInfo, object defaultParams)
         {
-            var algID = keyInfo.AlgorithmID;
-            var oid = algID.Algorithm;
+            var oid = keyInfo.Algorithm.Algorithm;
 
             SubjectPublicKeyInfoConverter converter = CollectionUtilities.GetValueOrNull(Converters, oid)
                 ?? throw new IOException("algorithm identifier in public key not recognised: " + oid);
@@ -222,7 +221,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Utilities
             {
                 byte[] keyEnc = Asn1OctetString.GetInstance(keyInfo.ParsePublicKey()).GetOctets();
 
-                SphincsPlusParameters spParams = PqcUtilities.SphincsPlusParamsLookup(keyInfo.AlgorithmID.Algorithm);
+                SphincsPlusParameters spParams = PqcUtilities.SphincsPlusParamsLookup(keyInfo.Algorithm.Algorithm);
 
                 return new SphincsPlusPublicKeyParameters(spParams, Arrays.CopyOfRange(keyEnc, 4, keyEnc.Length));
             }
@@ -235,7 +234,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Utilities
             {
                 byte[] keyEnc = CmcePublicKey.GetInstance(keyInfo.ParsePublicKey()).T;
 
-                CmceParameters spParams = PqcUtilities.McElieceParamsLookup(keyInfo.AlgorithmID.Algorithm);
+                CmceParameters spParams = PqcUtilities.McElieceParamsLookup(keyInfo.Algorithm.Algorithm);
 
                 return new CmcePublicKeyParameters(spParams, keyEnc);
             }
@@ -248,7 +247,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Utilities
             {
                 byte[] keyEnc = Asn1OctetString.GetInstance(keyInfo.ParsePublicKey()).GetOctets();
 
-                FrodoParameters fParams = PqcUtilities.FrodoParamsLookup(keyInfo.AlgorithmID.Algorithm);
+                FrodoParameters fParams = PqcUtilities.FrodoParamsLookup(keyInfo.Algorithm.Algorithm);
 
                 return new FrodoPublicKeyParameters(fParams, keyEnc);
             }
@@ -262,7 +261,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Utilities
                 byte[] keyEnc = Asn1OctetString.GetInstance(
                     Asn1Sequence.GetInstance(keyInfo.ParsePublicKey())[0]).GetOctets();
 
-                SaberParameters saberParams = PqcUtilities.SaberParamsLookup(keyInfo.AlgorithmID.Algorithm);
+                SaberParameters saberParams = PqcUtilities.SaberParamsLookup(keyInfo.Algorithm.Algorithm);
 
                 return new SaberPublicKeyParameters(saberParams, keyEnc);
             }
@@ -275,7 +274,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Utilities
             {
                 byte[] keyEnc = Asn1OctetString.GetInstance(keyInfo.ParsePublicKey()).GetOctets();
 
-                PicnicParameters picnicParams = PqcUtilities.PicnicParamsLookup(keyInfo.AlgorithmID.Algorithm);
+                PicnicParameters picnicParams = PqcUtilities.PicnicParamsLookup(keyInfo.Algorithm.Algorithm);
 
                 return new PicnicPublicKeyParameters(picnicParams, keyEnc);
             }
@@ -289,7 +288,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Utilities
             {
                 byte[] keyEnc = Asn1OctetString.GetInstance(keyInfo.ParsePublicKey()).GetOctets();
 
-                SikeParameters sikeParams = PqcUtilities.SikeParamsLookup(keyInfo.AlgorithmID.Algorithm);
+                SikeParameters sikeParams = PqcUtilities.SikeParamsLookup(keyInfo.Algorithm.Algorithm);
 
                 return new SikePublicKeyParameters(sikeParams, keyEnc);
             }
@@ -301,9 +300,9 @@ namespace Org.BouncyCastle.Pqc.Crypto.Utilities
             internal override AsymmetricKeyParameter GetPublicKeyParameters(SubjectPublicKeyInfo keyInfo,
                 object defaultParams)
             {
-                var dilithiumParameters = PqcUtilities.DilithiumParamsLookup(keyInfo.AlgorithmID.Algorithm);
+                var dilithiumParameters = PqcUtilities.DilithiumParamsLookup(keyInfo.Algorithm.Algorithm);
 
-                return GetPublicKeyParameters(dilithiumParameters, keyInfo.PublicKeyData);
+                return GetPublicKeyParameters(dilithiumParameters, keyInfo.PublicKey);
             }
 
             internal static DilithiumPublicKeyParameters GetPublicKeyParameters(DilithiumParameters dilithiumParameters,
@@ -339,7 +338,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Utilities
             internal override AsymmetricKeyParameter GetPublicKeyParameters(SubjectPublicKeyInfo keyInfo,
                 object defaultParams)
             {
-                KyberParameters kyberParameters = PqcUtilities.KyberParamsLookup(keyInfo.AlgorithmID.Algorithm);
+                KyberParameters kyberParameters = PqcUtilities.KyberParamsLookup(keyInfo.Algorithm.Algorithm);
 
                 try
                 {
@@ -353,7 +352,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Utilities
                 catch (Exception)
                 {
                     // we're a raw encoding
-                    return new KyberPublicKeyParameters(kyberParameters, keyInfo.PublicKeyData.GetOctets());
+                    return new KyberPublicKeyParameters(kyberParameters, keyInfo.PublicKey.GetOctets());
                 }
             }
         }
@@ -363,7 +362,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Utilities
         {
             internal override AsymmetricKeyParameter GetPublicKeyParameters(SubjectPublicKeyInfo keyInfo, object defaultParams)
             {
-                FalconParameters falconParams = PqcUtilities.FalconParamsLookup(keyInfo.AlgorithmID.Algorithm);
+                FalconParameters falconParams = PqcUtilities.FalconParamsLookup(keyInfo.Algorithm.Algorithm);
 
                 try
                 {
@@ -389,7 +388,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Utilities
                 catch (Exception)
                 {
                     // raw encoding
-                    byte[] keyEnc = keyInfo.PublicKeyData.GetOctets();
+                    byte[] keyEnc = keyInfo.PublicKey.GetOctets();
 
                     if (keyEnc[0] != (byte)(0x00 + falconParams.LogN))
                     {
@@ -406,7 +405,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Utilities
             {
                 byte[] keyEnc = Asn1OctetString.GetInstance(keyInfo.ParsePublicKey()).GetOctets();
 
-                BikeParameters bikeParams = PqcUtilities.BikeParamsLookup(keyInfo.AlgorithmID.Algorithm);
+                BikeParameters bikeParams = PqcUtilities.BikeParamsLookup(keyInfo.Algorithm.Algorithm);
 
                 return new BikePublicKeyParameters(bikeParams, keyEnc);
             }
@@ -418,7 +417,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Utilities
             {
                 byte[] keyEnc = Asn1OctetString.GetInstance(keyInfo.ParsePublicKey()).GetOctets();
 
-                HqcParameters hqcParams = PqcUtilities.HqcParamsLookup(keyInfo.AlgorithmID.Algorithm);
+                HqcParameters hqcParams = PqcUtilities.HqcParamsLookup(keyInfo.Algorithm.Algorithm);
 
                 return new HqcPublicKeyParameters(hqcParams, keyEnc);
             }
diff --git a/crypto/src/security/PublicKeyFactory.cs b/crypto/src/security/PublicKeyFactory.cs
index d3ecef5c7..dd34b84ff 100644
--- a/crypto/src/security/PublicKeyFactory.cs
+++ b/crypto/src/security/PublicKeyFactory.cs
@@ -41,7 +41,7 @@ namespace Org.BouncyCastle.Security
         public static AsymmetricKeyParameter CreateKey(
             SubjectPublicKeyInfo keyInfo)
         {
-            AlgorithmIdentifier algID = keyInfo.AlgorithmID;
+            AlgorithmIdentifier algID = keyInfo.Algorithm;
             DerObjectIdentifier algOid = algID.Algorithm;
 
             // TODO See RSAUtil.isRsaOid in Java build
@@ -139,7 +139,7 @@ namespace Org.BouncyCastle.Security
                     x9 = new X9ECParameters((Asn1Sequence)para.Parameters);
                 }
 
-                Asn1OctetString key = new DerOctetString(keyInfo.PublicKeyData.GetBytes());
+                Asn1OctetString key = new DerOctetString(keyInfo.PublicKey.GetBytes());
                 X9ECPoint derQ = new X9ECPoint(x9.Curve, key);
                 ECPoint q = derQ.Point;
 
@@ -287,7 +287,7 @@ namespace Org.BouncyCastle.Security
              * TODO[RFC 8422]
              * - Require keyInfo.Algorithm.Parameters == null?
              */
-            return keyInfo.PublicKeyData.GetOctetsSpan();
+            return keyInfo.PublicKey.GetOctetsSpan();
         }
 #else
         private static byte[] GetRawKey(SubjectPublicKeyInfo keyInfo)
@@ -296,7 +296,7 @@ namespace Org.BouncyCastle.Security
              * TODO[RFC 8422]
              * - Require keyInfo.Algorithm.Parameters == null?
              */
-            return keyInfo.PublicKeyData.GetOctets();
+            return keyInfo.PublicKey.GetOctets();
         }
 #endif
 
diff --git a/crypto/src/tls/crypto/impl/bc/BcTlsRawKeyCertificate.cs b/crypto/src/tls/crypto/impl/bc/BcTlsRawKeyCertificate.cs
index 4d208b35a..0e05b374a 100644
--- a/crypto/src/tls/crypto/impl/bc/BcTlsRawKeyCertificate.cs
+++ b/crypto/src/tls/crypto/impl/bc/BcTlsRawKeyCertificate.cs
@@ -414,19 +414,19 @@ namespace Org.BouncyCastle.Tls.Crypto.Impl.BC
 
         protected virtual bool SupportsRsa_Pkcs1()
         {
-            AlgorithmIdentifier pubKeyAlgID = m_keyInfo.AlgorithmID;
+            AlgorithmIdentifier pubKeyAlgID = m_keyInfo.Algorithm;
             return RsaUtilities.SupportsPkcs1(pubKeyAlgID);
         }
 
         protected virtual bool SupportsRsa_Pss_Pss(short signatureAlgorithm)
         {
-            AlgorithmIdentifier pubKeyAlgID = m_keyInfo.AlgorithmID;
+            AlgorithmIdentifier pubKeyAlgID = m_keyInfo.Algorithm;
             return RsaUtilities.SupportsPss_Pss(signatureAlgorithm, pubKeyAlgID);
         }
 
         protected virtual bool SupportsRsa_Pss_Rsae()
         {
-            AlgorithmIdentifier pubKeyAlgID = m_keyInfo.AlgorithmID;
+            AlgorithmIdentifier pubKeyAlgID = m_keyInfo.Algorithm;
             return RsaUtilities.SupportsPss_Rsae(pubKeyAlgID);
         }
 
diff --git a/crypto/src/x509/store/X509CertStoreSelector.cs b/crypto/src/x509/store/X509CertStoreSelector.cs
index 54ae923a9..ca15b9efa 100644
--- a/crypto/src/x509/store/X509CertStoreSelector.cs
+++ b/crypto/src/x509/store/X509CertStoreSelector.cs
@@ -280,7 +280,7 @@ namespace Org.BouncyCastle.X509.Store
 				return false;
 
 			if (subjectPublicKeyAlgID != null
-				&& !subjectPublicKeyAlgID.Equals(GetSubjectPublicKey(c).AlgorithmID))
+				&& !subjectPublicKeyAlgID.Equals(GetSubjectPublicKey(c).Algorithm))
 				return false;
 
 			return true;