diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2020-07-30 20:19:37 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2020-07-30 20:19:37 +0700 |
commit | 0d3f1208b3f22329da901bd8764297673c6ae970 (patch) | |
tree | 11bd82392fc34db1180d51aab2be97da02158c3c /crypto | |
parent | PGP updates from bc-java (diff) | |
download | BouncyCastle.NET-ed25519-0d3f1208b3f22329da901bd8764297673c6ae970.tar.xz |
Misc. updates from bc-java
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/src/asn1/pkcs/PrivateKeyInfo.cs | 5 | ||||
-rw-r--r-- | crypto/src/crypto/encodings/Pkcs1Encoding.cs | 2 | ||||
-rw-r--r-- | crypto/src/crypto/tls/TlsDHKeyExchange.cs | 2 | ||||
-rw-r--r-- | crypto/src/crypto/tls/TlsECDHKeyExchange.cs | 2 | ||||
-rw-r--r-- | crypto/src/crypto/tls/TlsPskKeyExchange.cs | 2 | ||||
-rw-r--r-- | crypto/src/crypto/tls/TlsRsaKeyExchange.cs | 2 | ||||
-rw-r--r-- | crypto/src/crypto/tls/TlsSrpKeyExchange.cs | 2 | ||||
-rw-r--r-- | crypto/src/util/Arrays.cs | 10 |
8 files changed, 21 insertions, 6 deletions
diff --git a/crypto/src/asn1/pkcs/PrivateKeyInfo.cs b/crypto/src/asn1/pkcs/PrivateKeyInfo.cs index c5c7c3a2f..d52a31f73 100644 --- a/crypto/src/asn1/pkcs/PrivateKeyInfo.cs +++ b/crypto/src/asn1/pkcs/PrivateKeyInfo.cs @@ -151,6 +151,11 @@ namespace Org.BouncyCastle.Asn1.Pkcs } } + public virtual DerInteger Version + { + get { return version; } + } + public virtual Asn1Set Attributes { get { return attributes; } diff --git a/crypto/src/crypto/encodings/Pkcs1Encoding.cs b/crypto/src/crypto/encodings/Pkcs1Encoding.cs index ce2f15a38..53c046a8a 100644 --- a/crypto/src/crypto/encodings/Pkcs1Encoding.cs +++ b/crypto/src/crypto/encodings/Pkcs1Encoding.cs @@ -224,7 +224,7 @@ namespace Org.BouncyCastle.Crypto.Encodings * Now the padding check, check for no 0 byte in the padding */ int plen = encoded.Length - ( - pLen /* Lenght of the PMS */ + pLen /* Length of the PMS */ + 1 /* Final 0-byte before PMS */ ); diff --git a/crypto/src/crypto/tls/TlsDHKeyExchange.cs b/crypto/src/crypto/tls/TlsDHKeyExchange.cs index 7b922352d..63abe27ce 100644 --- a/crypto/src/crypto/tls/TlsDHKeyExchange.cs +++ b/crypto/src/crypto/tls/TlsDHKeyExchange.cs @@ -73,7 +73,7 @@ namespace Org.BouncyCastle.Crypto.Tls if (mKeyExchange == KeyExchangeAlgorithm.DH_anon) throw new TlsFatalAlert(AlertDescription.unexpected_message); if (serverCertificate.IsEmpty) - throw new TlsFatalAlert(AlertDescription.bad_certificate); + throw new TlsFatalAlert(AlertDescription.decode_error); X509CertificateStructure x509Cert = serverCertificate.GetCertificateAt(0); diff --git a/crypto/src/crypto/tls/TlsECDHKeyExchange.cs b/crypto/src/crypto/tls/TlsECDHKeyExchange.cs index c508fb993..44fd94cbd 100644 --- a/crypto/src/crypto/tls/TlsECDHKeyExchange.cs +++ b/crypto/src/crypto/tls/TlsECDHKeyExchange.cs @@ -69,7 +69,7 @@ namespace Org.BouncyCastle.Crypto.Tls if (mKeyExchange == KeyExchangeAlgorithm.ECDH_anon) throw new TlsFatalAlert(AlertDescription.unexpected_message); if (serverCertificate.IsEmpty) - throw new TlsFatalAlert(AlertDescription.bad_certificate); + throw new TlsFatalAlert(AlertDescription.decode_error); X509CertificateStructure x509Cert = serverCertificate.GetCertificateAt(0); diff --git a/crypto/src/crypto/tls/TlsPskKeyExchange.cs b/crypto/src/crypto/tls/TlsPskKeyExchange.cs index 31f4c002d..aec7af7b5 100644 --- a/crypto/src/crypto/tls/TlsPskKeyExchange.cs +++ b/crypto/src/crypto/tls/TlsPskKeyExchange.cs @@ -126,7 +126,7 @@ namespace Org.BouncyCastle.Crypto.Tls if (mKeyExchange != KeyExchangeAlgorithm.RSA_PSK) throw new TlsFatalAlert(AlertDescription.unexpected_message); if (serverCertificate.IsEmpty) - throw new TlsFatalAlert(AlertDescription.bad_certificate); + throw new TlsFatalAlert(AlertDescription.decode_error); X509CertificateStructure x509Cert = serverCertificate.GetCertificateAt(0); diff --git a/crypto/src/crypto/tls/TlsRsaKeyExchange.cs b/crypto/src/crypto/tls/TlsRsaKeyExchange.cs index b02d56486..0e7195ff6 100644 --- a/crypto/src/crypto/tls/TlsRsaKeyExchange.cs +++ b/crypto/src/crypto/tls/TlsRsaKeyExchange.cs @@ -47,7 +47,7 @@ namespace Org.BouncyCastle.Crypto.Tls public override void ProcessServerCertificate(Certificate serverCertificate) { if (serverCertificate.IsEmpty) - throw new TlsFatalAlert(AlertDescription.bad_certificate); + throw new TlsFatalAlert(AlertDescription.decode_error); X509CertificateStructure x509Cert = serverCertificate.GetCertificateAt(0); diff --git a/crypto/src/crypto/tls/TlsSrpKeyExchange.cs b/crypto/src/crypto/tls/TlsSrpKeyExchange.cs index 09fa72348..691c88131 100644 --- a/crypto/src/crypto/tls/TlsSrpKeyExchange.cs +++ b/crypto/src/crypto/tls/TlsSrpKeyExchange.cs @@ -97,7 +97,7 @@ namespace Org.BouncyCastle.Crypto.Tls if (mTlsSigner == null) throw new TlsFatalAlert(AlertDescription.unexpected_message); if (serverCertificate.IsEmpty) - throw new TlsFatalAlert(AlertDescription.bad_certificate); + throw new TlsFatalAlert(AlertDescription.decode_error); X509CertificateStructure x509Cert = serverCertificate.GetCertificateAt(0); diff --git a/crypto/src/util/Arrays.cs b/crypto/src/util/Arrays.cs index 7b1766bba..03b451ef9 100644 --- a/crypto/src/util/Arrays.cs +++ b/crypto/src/util/Arrays.cs @@ -782,5 +782,15 @@ namespace Org.BouncyCastle.Utilities } return false; } + + public static bool IsNullOrEmpty(byte[] array) + { + return null == array || array.Length < 1; + } + + public static bool IsNullOrEmpty(object[] array) + { + return null == array || array.Length < 1; + } } } |