diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2019-09-09 15:52:36 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2019-09-09 15:52:36 +0700 |
commit | 71a58e93463e0a7e4f277069f9e133a98a9a8bcb (patch) | |
tree | b14b3c28149ece39a59bf14d6f2d45bed7774dcd /crypto/src/asn1/x509 | |
parent | Add sanity checks on scalar mult. outputs (diff) | |
download | BouncyCastle.NET-ed25519-71a58e93463e0a7e4f277069f9e133a98a9a8bcb.tar.xz |
Port of strict hex decoding from bc-java
Diffstat (limited to 'crypto/src/asn1/x509')
-rw-r--r-- | crypto/src/asn1/x509/X509Name.cs | 2 | ||||
-rw-r--r-- | crypto/src/asn1/x509/X509NameEntryConverter.cs | 4 |
2 files changed, 2 insertions, 4 deletions
diff --git a/crypto/src/asn1/x509/X509Name.cs b/crypto/src/asn1/x509/X509Name.cs index aa46caaac..c3c3cc6c9 100644 --- a/crypto/src/asn1/x509/X509Name.cs +++ b/crypto/src/asn1/x509/X509Name.cs @@ -928,7 +928,7 @@ namespace Org.BouncyCastle.Asn1.X509 { try { - return Asn1Object.FromByteArray(Hex.Decode(v.Substring(1))); + return Asn1Object.FromByteArray(Hex.DecodeStrict(v, 1, v.Length - 1)); } catch (IOException e) { diff --git a/crypto/src/asn1/x509/X509NameEntryConverter.cs b/crypto/src/asn1/x509/X509NameEntryConverter.cs index 5872656a9..a5a00cc59 100644 --- a/crypto/src/asn1/x509/X509NameEntryConverter.cs +++ b/crypto/src/asn1/x509/X509NameEntryConverter.cs @@ -61,9 +61,7 @@ namespace Org.BouncyCastle.Asn1.X509 string hexString, int offset) { - string str = hexString.Substring(offset); - - return Asn1Object.FromByteArray(Hex.Decode(str)); + return Asn1Object.FromByteArray(Hex.DecodeStrict(hexString, offset, hexString.Length - offset)); } /** |