From 72692ac5cc5353ab151d1281d18ea1d9951292d7 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Tue, 24 Oct 2023 17:15:33 +0700 Subject: Refactoring in Asn1.X500 --- crypto/src/asn1/x500/Rdn.cs | 4 +--- crypto/src/asn1/x500/style/IetfUtilities.cs | 11 ++++------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/crypto/src/asn1/x500/Rdn.cs b/crypto/src/asn1/x500/Rdn.cs index 069a592a5..23537e1ae 100644 --- a/crypto/src/asn1/x500/Rdn.cs +++ b/crypto/src/asn1/x500/Rdn.cs @@ -2,9 +2,7 @@ namespace Org.BouncyCastle.Asn1.X500 { - /** - * Holding class for a single Relative Distinguished Name (RDN). - */ + /// Holding class for a single Relative Distinguished Name (RDN). public class Rdn : Asn1Encodable { diff --git a/crypto/src/asn1/x500/style/IetfUtilities.cs b/crypto/src/asn1/x500/style/IetfUtilities.cs index acc1ed72e..dd2996bae 100644 --- a/crypto/src/asn1/x500/style/IetfUtilities.cs +++ b/crypto/src/asn1/x500/style/IetfUtilities.cs @@ -89,10 +89,9 @@ namespace Org.BouncyCastle.Asn1.X500.Style if (buf.Length > 0) { - int last = buf.Length - 1; - while (buf[last] == ' ' && lastEscaped != last) + while (buf[buf.Length - 1] == ' ' && lastEscaped != buf.Length - 1) { - buf.Length = last; + buf.Length = buf.Length - 1; } } @@ -107,13 +106,11 @@ namespace Org.BouncyCastle.Asn1.X500.Style private static int ConvertHex(char c) { if ('0' <= c && c <= '9') - { return c - '0'; - } + if ('a' <= c && c <= 'f') - { return c - 'a' + 10; - } + return c - 'A' + 10; } -- cgit 1.4.1