summary refs log tree commit diff
path: root/crypto/src/x509/X509Certificate.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/x509/X509Certificate.cs')
-rw-r--r--crypto/src/x509/X509Certificate.cs15
1 files changed, 6 insertions, 9 deletions
diff --git a/crypto/src/x509/X509Certificate.cs b/crypto/src/x509/X509Certificate.cs
index 5b800efe5..e69aca1ce 100644
--- a/crypto/src/x509/X509Certificate.cs
+++ b/crypto/src/x509/X509Certificate.cs
@@ -339,7 +339,6 @@ namespace Org.BouncyCastle.X509
             return Arrays.Clone(keyUsage);
         }
 
-        // TODO Replace with something that returns a list of DerObjectIdentifier
         public virtual IList<DerObjectIdentifier> GetExtendedKeyUsage()
         {
             Asn1OctetString str = GetExtensionValue(X509Extensions.ExtendedKeyUsage);
@@ -576,12 +575,12 @@ namespace Org.BouncyCastle.X509
             buf.Append("  Signature Algorithm: ").Append(this.SigAlgName).AppendLine();
 
             byte[] sig = this.GetSignature();
-            buf.Append("            Signature: ").Append(Hex.ToHexString(sig, 0, 20)).AppendLine();
+            buf.Append("            Signature: ").AppendLine(Hex.ToHexString(sig, 0, 20));
 
             for (int i = 20; i < sig.Length; i += 20)
             {
                 int len = System.Math.Min(20, sig.Length - i);
-                buf.Append("                       ").Append(Hex.ToHexString(sig, i, len)).AppendLine();
+                buf.Append("                       ").AppendLine(Hex.ToHexString(sig, i, len));
             }
 
             X509Extensions extensions = c.TbsCertificate.Extensions;
@@ -592,7 +591,7 @@ namespace Org.BouncyCastle.X509
 
                 if (e.MoveNext())
                 {
-                    buf.Append("       Extensions: \n");
+                    buf.AppendLine("       Extensions:");
                 }
 
                 do
@@ -680,15 +679,13 @@ namespace Org.BouncyCastle.X509
             if (!IsAlgIDEqual(c.SignatureAlgorithm, c.TbsCertificate.Signature))
                 throw new CertificateException("signature algorithm in TBS cert not same as outer cert");
 
-            byte[] b = GetTbsCertificate();
-
             IStreamCalculator<IVerifier> streamCalculator = verifier.CreateCalculator();
             using (var stream = streamCalculator.Stream)
             {
-                stream.Write(b, 0, b.Length);
+                c.TbsCertificate.EncodeTo(stream, Asn1Encodable.Der);
             }
 
-            if (!streamCalculator.GetResult().IsVerified(this.GetSignature()))
+            if (!streamCalculator.GetResult().IsVerified(GetSignature()))
                 throw new InvalidKeyException("Public key presented not for certificate signature");
         }
 
@@ -733,7 +730,7 @@ namespace Org.BouncyCastle.X509
             Asn1Encodable p2 = id2.Parameters;
 
             if ((p1 == null) == (p2 == null))
-                return Platform.Equals(p1, p2);
+                return Objects.Equals(p1, p2);
 
             // Exactly one of p1, p2 is null at this point
             return p1 == null