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);
}
}
|