diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-06-29 14:07:20 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-06-29 14:07:20 +0700 |
commit | fe7d3e0009ae2ba833be66729221f42ac3aa0464 (patch) | |
tree | 7008925a5fb5a59a32fcd40ab0638a8e6888de08 /crypto/src/pkix | |
parent | Refactor Asn1Dump (diff) | |
download | BouncyCastle.NET-ed25519-fe7d3e0009ae2ba833be66729221f42ac3aa0464.tar.xz |
Refactoring around Platform
Diffstat (limited to 'crypto/src/pkix')
-rw-r--r-- | crypto/src/pkix/PkixCertPathBuilderResult.cs | 12 | ||||
-rw-r--r-- | crypto/src/pkix/PkixCertPathValidatorResult.cs | 13 | ||||
-rw-r--r-- | crypto/src/pkix/PkixCertPathValidatorUtilities.cs | 2 | ||||
-rw-r--r-- | crypto/src/pkix/PkixNameConstraintValidator.cs | 15 |
4 files changed, 18 insertions, 24 deletions
diff --git a/crypto/src/pkix/PkixCertPathBuilderResult.cs b/crypto/src/pkix/PkixCertPathBuilderResult.cs index f8003032f..639009a37 100644 --- a/crypto/src/pkix/PkixCertPathBuilderResult.cs +++ b/crypto/src/pkix/PkixCertPathBuilderResult.cs @@ -34,12 +34,12 @@ namespace Org.BouncyCastle.Pkix public override string ToString() { - StringBuilder s = new StringBuilder(); - s.Append("SimplePKIXCertPathBuilderResult: [\n"); - s.Append(" Certification Path: ").Append(CertPath).Append('\n'); - s.Append(" Trust Anchor: ").Append(this.TrustAnchor.TrustedCert.IssuerDN.ToString()).Append('\n'); - s.Append(" Subject Public Key: ").Append(this.SubjectPublicKey).Append("\n]"); - return s.ToString(); + StringBuilder sb = new StringBuilder(); + sb.AppendLine("SimplePKIXCertPathBuilderResult: ["); + sb.Append(" Certification Path: ").AppendLine(CertPath.ToString()); + sb.Append(" Trust Anchor: ").AppendLine(TrustAnchor.TrustedCert.IssuerDN.ToString()); + sb.Append(" Subject Public Key: ").AppendLine(SubjectPublicKey.ToString()); + return sb.ToString(); } } } diff --git a/crypto/src/pkix/PkixCertPathValidatorResult.cs b/crypto/src/pkix/PkixCertPathValidatorResult.cs index e316128b0..7df3eab21 100644 --- a/crypto/src/pkix/PkixCertPathValidatorResult.cs +++ b/crypto/src/pkix/PkixCertPathValidatorResult.cs @@ -57,13 +57,12 @@ namespace Org.BouncyCastle.Pkix public override string ToString() { - StringBuilder sB = new StringBuilder(); - sB.Append("PKIXCertPathValidatorResult: [ \n"); - sB.Append(" Trust Anchor: ").Append(this.TrustAnchor).Append('\n'); - sB.Append(" Policy Tree: ").Append(this.PolicyTree).Append('\n'); - sB.Append(" Subject Public Key: ").Append(this.SubjectPublicKey).Append("\n]"); - return sB.ToString(); + StringBuilder sb = new StringBuilder(); + sb.AppendLine("PKIXCertPathValidatorResult: ["); + sb.Append(" Trust Anchor: ").AppendLine(TrustAnchor.ToString()); + sb.Append(" Policy Tree: ").AppendLine(PolicyTree.ToString()); + sb.Append(" Subject Public Key: ").AppendLine(SubjectPublicKey.ToString()); + return sb.ToString(); } - } } diff --git a/crypto/src/pkix/PkixCertPathValidatorUtilities.cs b/crypto/src/pkix/PkixCertPathValidatorUtilities.cs index 80ae2f83d..fccd0b3c5 100644 --- a/crypto/src/pkix/PkixCertPathValidatorUtilities.cs +++ b/crypto/src/pkix/PkixCertPathValidatorUtilities.cs @@ -259,7 +259,7 @@ namespace Org.BouncyCastle.Pkix // baseDN = nsull; } - throw Platform.CreateNotImplementedException("LDAP cert/CRL stores"); + throw new NotImplementedException("LDAP cert/CRL stores"); // use all purpose parameters //X509LDAPCertStoreParameters ldapParams = new X509LDAPCertStoreParameters.Builder( diff --git a/crypto/src/pkix/PkixNameConstraintValidator.cs b/crypto/src/pkix/PkixNameConstraintValidator.cs index e3e8c2fa0..5ad4de6f8 100644 --- a/crypto/src/pkix/PkixNameConstraintValidator.cs +++ b/crypto/src/pkix/PkixNameConstraintValidator.cs @@ -495,18 +495,14 @@ namespace Org.BouncyCastle.Pkix // a particular mailbox if (constraint.IndexOf('@') != -1) { - if (Platform.ToUpperInvariant(email).Equals(Platform.ToUpperInvariant(constraint))) - { + if (string.Equals(email, constraint, StringComparison.OrdinalIgnoreCase)) return true; - } } // on particular host - else if (!(constraint[0].Equals('.'))) + else if (constraint[0] != '.') { - if (Platform.ToUpperInvariant(sub).Equals(Platform.ToUpperInvariant(constraint))) - { + if (string.Equals(sub, constraint, StringComparison.OrdinalIgnoreCase)) return true; - } } // address in sub domain else if (WithinDomain(sub, constraint)) @@ -1852,9 +1848,8 @@ namespace Org.BouncyCastle.Pkix private static void Append(StringBuilder sb, string name, object value) { sb.Append(name); - sb.Append(":\n"); - sb.Append(value); - sb.Append('\n'); + sb.AppendLine(":"); + sb.AppendLine(value.ToString()); } } } |