summary refs log tree commit diff
path: root/crypto
diff options
context:
space:
mode:
Diffstat (limited to 'crypto')
-rw-r--r--crypto/src/crypto/tls/CertificateRequest.cs4
1 files changed, 2 insertions, 2 deletions
diff --git a/crypto/src/crypto/tls/CertificateRequest.cs b/crypto/src/crypto/tls/CertificateRequest.cs
index 8ab265513..100398ffb 100644
--- a/crypto/src/crypto/tls/CertificateRequest.cs
+++ b/crypto/src/crypto/tls/CertificateRequest.cs
@@ -100,7 +100,7 @@ namespace Org.BouncyCastle.Crypto.Tls
                 {
                     byte[] derEncoding = certificateAuthority.GetEncoded(Asn1Encodable.Der);
                     derEncodings.Add(derEncoding);
-                    totalLength += derEncoding.Length;
+                    totalLength += derEncoding.Length + 2;
                 }
 
                 TlsUtilities.CheckUint16(totalLength);
@@ -108,7 +108,7 @@ namespace Org.BouncyCastle.Crypto.Tls
 
                 foreach (byte[] derEncoding in derEncodings)
                 {
-                    output.Write(derEncoding, 0, derEncoding.Length);
+                    TlsUtilities.WriteOpaque16(derEncoding, output);
                 }
             }
         }