Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/quite/humla-spongycastle.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2013-06-16 12:31:58 +0400
committerPeter Dettman <peter.dettman@bouncycastle.org>2013-06-16 12:31:58 +0400
commit936746ff5335374f92b29db972c561b1f7ae5102 (patch)
tree6d06a1f778f50b05892a2eb86185acf1c35e3e1a /core/src/main/java/org/bouncycastle/crypto/tls/TlsServerProtocol.java
parent27505944b58ee4d74e689977fb02e5b7fa716798 (diff)
Call TlsServer.getCertificateStatus, if applicable, and send
certificate_status handshake message accordingly
Diffstat (limited to 'core/src/main/java/org/bouncycastle/crypto/tls/TlsServerProtocol.java')
-rw-r--r--core/src/main/java/org/bouncycastle/crypto/tls/TlsServerProtocol.java23
1 files changed, 20 insertions, 3 deletions
diff --git a/core/src/main/java/org/bouncycastle/crypto/tls/TlsServerProtocol.java b/core/src/main/java/org/bouncycastle/crypto/tls/TlsServerProtocol.java
index 82216f17..fef6de3e 100644
--- a/core/src/main/java/org/bouncycastle/crypto/tls/TlsServerProtocol.java
+++ b/core/src/main/java/org/bouncycastle/crypto/tls/TlsServerProtocol.java
@@ -180,11 +180,10 @@ public class TlsServerProtocol
if (this.allowCertificateStatus)
{
- // TODO[RFC 3546] Get certificate status, if any, and send
- CertificateStatus certificateStatus = null; //tlsServer.getCertificateStatus();
+ CertificateStatus certificateStatus = tlsServer.getCertificateStatus();
if (certificateStatus != null)
{
-// sendCertificateStatusMessage(certificateStatus);
+ sendCertificateStatusMessage(certificateStatus);
}
}
@@ -635,6 +634,24 @@ public class TlsServerProtocol
safeWriteRecord(ContentType.handshake, message, 0, message.length);
}
+ protected void sendCertificateStatusMessage(CertificateStatus certificateStatus)
+ throws IOException
+ {
+ ByteArrayOutputStream buf = new ByteArrayOutputStream();
+ TlsUtils.writeUint8(HandshakeType.certificate_status, buf);
+
+ // Reserve space for length
+ TlsUtils.writeUint24(0, buf);
+
+ certificateStatus.encode(buf);
+ byte[] message = buf.toByteArray();
+
+ // Patch actual length back in
+ TlsUtils.writeUint24(message.length - 4, message, 1);
+
+ safeWriteRecord(ContentType.handshake, message, 0, message.length);
+ }
+
protected void sendNewSessionTicketMessage(NewSessionTicket newSessionTicket)
throws IOException
{