Skip to content

Commit 0d3f120

Browse files
committed
Misc. updates from bc-java
1 parent 7c958e4 commit 0d3f120

File tree

8 files changed

+21
-6
lines changed

8 files changed

+21
-6
lines changed

crypto/src/asn1/pkcs/PrivateKeyInfo.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,11 @@ private PrivateKeyInfo(Asn1Sequence seq)
151151
}
152152
}
153153

154+
public virtual DerInteger Version
155+
{
156+
get { return version; }
157+
}
158+
154159
public virtual Asn1Set Attributes
155160
{
156161
get { return attributes; }

crypto/src/crypto/encodings/Pkcs1Encoding.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ private static int CheckPkcs1Encoding(byte[] encoded, int pLen)
224224
* Now the padding check, check for no 0 byte in the padding
225225
*/
226226
int plen = encoded.Length - (
227-
pLen /* Lenght of the PMS */
227+
pLen /* Length of the PMS */
228228
+ 1 /* Final 0-byte before PMS */
229229
);
230230

crypto/src/crypto/tls/TlsDHKeyExchange.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public override void ProcessServerCertificate(Certificate serverCertificate)
7373
if (mKeyExchange == KeyExchangeAlgorithm.DH_anon)
7474
throw new TlsFatalAlert(AlertDescription.unexpected_message);
7575
if (serverCertificate.IsEmpty)
76-
throw new TlsFatalAlert(AlertDescription.bad_certificate);
76+
throw new TlsFatalAlert(AlertDescription.decode_error);
7777

7878
X509CertificateStructure x509Cert = serverCertificate.GetCertificateAt(0);
7979

crypto/src/crypto/tls/TlsECDHKeyExchange.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public override void ProcessServerCertificate(Certificate serverCertificate)
6969
if (mKeyExchange == KeyExchangeAlgorithm.ECDH_anon)
7070
throw new TlsFatalAlert(AlertDescription.unexpected_message);
7171
if (serverCertificate.IsEmpty)
72-
throw new TlsFatalAlert(AlertDescription.bad_certificate);
72+
throw new TlsFatalAlert(AlertDescription.decode_error);
7373

7474
X509CertificateStructure x509Cert = serverCertificate.GetCertificateAt(0);
7575

crypto/src/crypto/tls/TlsPskKeyExchange.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public override void ProcessServerCertificate(Certificate serverCertificate)
126126
if (mKeyExchange != KeyExchangeAlgorithm.RSA_PSK)
127127
throw new TlsFatalAlert(AlertDescription.unexpected_message);
128128
if (serverCertificate.IsEmpty)
129-
throw new TlsFatalAlert(AlertDescription.bad_certificate);
129+
throw new TlsFatalAlert(AlertDescription.decode_error);
130130

131131
X509CertificateStructure x509Cert = serverCertificate.GetCertificateAt(0);
132132

crypto/src/crypto/tls/TlsRsaKeyExchange.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public override void ProcessServerCredentials(TlsCredentials serverCredentials)
4747
public override void ProcessServerCertificate(Certificate serverCertificate)
4848
{
4949
if (serverCertificate.IsEmpty)
50-
throw new TlsFatalAlert(AlertDescription.bad_certificate);
50+
throw new TlsFatalAlert(AlertDescription.decode_error);
5151

5252
X509CertificateStructure x509Cert = serverCertificate.GetCertificateAt(0);
5353

crypto/src/crypto/tls/TlsSrpKeyExchange.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public override void ProcessServerCertificate(Certificate serverCertificate)
9797
if (mTlsSigner == null)
9898
throw new TlsFatalAlert(AlertDescription.unexpected_message);
9999
if (serverCertificate.IsEmpty)
100-
throw new TlsFatalAlert(AlertDescription.bad_certificate);
100+
throw new TlsFatalAlert(AlertDescription.decode_error);
101101

102102
X509CertificateStructure x509Cert = serverCertificate.GetCertificateAt(0);
103103

crypto/src/util/Arrays.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -782,5 +782,15 @@ public static bool IsNullOrContainsNull(object[] array)
782782
}
783783
return false;
784784
}
785+
786+
public static bool IsNullOrEmpty(byte[] array)
787+
{
788+
return null == array || array.Length < 1;
789+
}
790+
791+
public static bool IsNullOrEmpty(object[] array)
792+
{
793+
return null == array || array.Length < 1;
794+
}
785795
}
786796
}

0 commit comments

Comments
 (0)