summary refs log tree commit diff
path: root/crypto/src/x509
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2023-01-28 18:57:30 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2023-01-28 18:57:30 +0700
commit558aef70537b3882e5616e9d0e7b40d971e2dd42 (patch)
tree1ac43c975f414e69a268dca315a10a87fa406ea8 /crypto/src/x509
parentAdd Xoodyak to the master branch (diff)
downloadBouncyCastle.NET-ed25519-558aef70537b3882e5616e9d0e7b40d971e2dd42.tar.xz
Misc. cleanup after bc-fips-csharp updates
Diffstat (limited to '')
-rw-r--r--crypto/src/x509/AttributeCertificateHolder.cs36
-rw-r--r--crypto/src/x509/AttributeCertificateIssuer.cs15
-rw-r--r--crypto/src/x509/X509Certificate.cs7
-rw-r--r--crypto/src/x509/X509Crl.cs6
-rw-r--r--crypto/src/x509/X509CrlEntry.cs2
-rw-r--r--crypto/src/x509/X509V2CRLGenerator.cs1
6 files changed, 29 insertions, 38 deletions
diff --git a/crypto/src/x509/AttributeCertificateHolder.cs b/crypto/src/x509/AttributeCertificateHolder.cs
index b3cea1cfe..903886085 100644
--- a/crypto/src/x509/AttributeCertificateHolder.cs
+++ b/crypto/src/x509/AttributeCertificateHolder.cs
@@ -360,26 +360,26 @@ namespace Org.BouncyCastle.X509
 
 					switch (DigestedObjectType)
 					{
-						case ObjectDigestInfo.PublicKey:
-						{
-							// TODO: DSA Dss-parms
-
-							//byte[] b = x509Cert.GetPublicKey().getEncoded();
-							// TODO Is this the right way to encode?
-							byte[] b = SubjectPublicKeyInfoFactory.CreateSubjectPublicKeyInfo(
-								x509Cert.GetPublicKey()).GetEncoded();
-							md.BlockUpdate(b, 0, b.Length);
-							break;
-						}
+					case ObjectDigestInfo.PublicKey:
+					{
+						// TODO: DSA Dss-parms
+
+						//byte[] b = x509Cert.GetPublicKey().getEncoded();
+						// TODO Is this the right way to encode?
+						byte[] b = SubjectPublicKeyInfoFactory.CreateSubjectPublicKeyInfo(
+							x509Cert.GetPublicKey()).GetEncoded();
+						md.BlockUpdate(b, 0, b.Length);
+						break;
+					}
 
-						case ObjectDigestInfo.PublicKeyCert:
-						{
-							byte[] b = x509Cert.GetEncoded();
-							md.BlockUpdate(b, 0, b.Length);
-							break;
-						}
+					case ObjectDigestInfo.PublicKeyCert:
+					{
+						byte[] b = x509Cert.GetEncoded();
+						md.BlockUpdate(b, 0, b.Length);
+						break;
+					}
 
-						// TODO Default handler?
+					// TODO Default handler?
 					}
 
 					// TODO Shouldn't this be the other way around?
diff --git a/crypto/src/x509/AttributeCertificateIssuer.cs b/crypto/src/x509/AttributeCertificateIssuer.cs
index 799a48877..b0eb65cc8 100644
--- a/crypto/src/x509/AttributeCertificateIssuer.cs
+++ b/crypto/src/x509/AttributeCertificateIssuer.cs
@@ -149,25 +149,18 @@ namespace Org.BouncyCastle.X509
 				return MatchesDN(x509Cert.SubjectDN, issuer.IssuerName);
 			}
 
-			return MatchesDN(x509Cert.SubjectDN, (GeneralNames) form);
+			return MatchesDN(x509Cert.SubjectDN, (GeneralNames)form);
 		}
 
-		public override bool Equals(
-			object obj)
+		public override bool Equals(object obj)
 		{
 			if (obj == this)
-			{
 				return true;
-			}
 
-			if (!(obj is AttributeCertificateIssuer))
-			{
+			if (!(obj is AttributeCertificateIssuer that))
 				return false;
-			}
-
-			AttributeCertificateIssuer other = (AttributeCertificateIssuer)obj;
 
-			return this.form.Equals(other.form);
+			return this.form.Equals(that.form);
 		}
 
 		public override int GetHashCode()
diff --git a/crypto/src/x509/X509Certificate.cs b/crypto/src/x509/X509Certificate.cs
index db6966a0f..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
diff --git a/crypto/src/x509/X509Crl.cs b/crypto/src/x509/X509Crl.cs
index 027813562..a3f08a0ed 100644
--- a/crypto/src/x509/X509Crl.cs
+++ b/crypto/src/x509/X509Crl.cs
@@ -306,13 +306,13 @@ namespace Org.BouncyCastle.X509
 			byte[] sig = this.GetSignature();
 
 			buf.Append("            Signature: ");
-			buf.Append(Hex.ToHexString(sig, 0, 20)).AppendLine();
+			buf.AppendLine(Hex.ToHexString(sig, 0, 20));
 
 			for (int i = 20; i < sig.Length; i += 20)
 			{
 				int count = System.Math.Min(20, sig.Length - i);
 				buf.Append("                       ");
-				buf.Append(Hex.ToHexString(sig, i, count)).AppendLine();
+				buf.AppendLine(Hex.ToHexString(sig, i, count));
 			}
 
 			X509Extensions extensions = c.TbsCertList.Extensions;
@@ -323,7 +323,7 @@ namespace Org.BouncyCastle.X509
 
 				if (e.MoveNext())
 				{
-					buf.Append("           Extensions: ").AppendLine();
+					buf.AppendLine("           Extensions:");
 				}
 
 				do
diff --git a/crypto/src/x509/X509CrlEntry.cs b/crypto/src/x509/X509CrlEntry.cs
index 87fc2e37a..0c45c857d 100644
--- a/crypto/src/x509/X509CrlEntry.cs
+++ b/crypto/src/x509/X509CrlEntry.cs
@@ -177,7 +177,7 @@ namespace Org.BouncyCastle.X509
 				var e = extensions.ExtensionOids.GetEnumerator();
 				if (e.MoveNext())
 				{
-					buf.Append("   crlEntryExtensions:").AppendLine();
+					buf.AppendLine("   crlEntryExtensions:");
 
 					do
 					{
diff --git a/crypto/src/x509/X509V2CRLGenerator.cs b/crypto/src/x509/X509V2CRLGenerator.cs
index 3d8b96ad2..01d7aee4a 100644
--- a/crypto/src/x509/X509V2CRLGenerator.cs
+++ b/crypto/src/x509/X509V2CRLGenerator.cs
@@ -7,7 +7,6 @@ using Org.BouncyCastle.Asn1.X509;
 using Org.BouncyCastle.Crypto;
 using Org.BouncyCastle.Math;
 using Org.BouncyCastle.Security.Certificates;
-using Org.BouncyCastle.Utilities;
 
 namespace Org.BouncyCastle.X509
 {