bouncycastle pskserver error

Sukawanth psr <[email protected]> Fri, 3 May 2019 14:59:11 +0530
Newsgroups gmane.comp.encryption.bouncy-castle.devel
Message-ID <CAA63y8RnNc4pw1PQWFdQj4vxahE3omi8cONb+eqCZ4DoPd=kKg@mail.gmail.com>
I am trying to write PSKServer to use PSK ciphers in bouncycastle.

Attached is the PSK server we wrote. And we are using
org.bouncycastle.tls.test.PSKTlsClientTest as client for testing.



I see below error while tls handshake.



I am using 1.6.1 version.



org.bouncycastle.tls.TlsFatalAlert: bad_record_mac(20)

              at
org.bouncycastle.tls.crypto.impl.TlsBlockCipher.decodeCiphertext(Unknown
Source)

              at org.bouncycastle.tls.RecordStream.decodeAndVerify(Unknown
Source)

              at org.bouncycastle.tls.RecordStream.readRecord(Unknown
Source)

              at org.bouncycastle.tls.TlsProtocol.safeReadRecord(Unknown
Source)

              at org.bouncycastle.tls.TlsProtocol.blockForHandshake(Unknown
Source)

              at org.bouncycastle.tls.TlsServerProtocol.accept(Unknown
Source)

              at
com.oracle.test.TlsServerTest$ServerThread.run(TlsServerTest.java:62)

Exception in thread "Thread-1" java.lang.RuntimeException:
org.bouncycastle.tls.TlsFatalAlert: bad_record_mac(20)

              at
com.oracle.test.TlsServerTest$ServerThread.run(TlsServerTest.java:69)

Caused by: org.bouncycastle.tls.TlsFatalAlert: bad_record_mac(20)

              at
org.bouncycastle.tls.crypto.impl.TlsBlockCipher.decodeCiphertext(Unknown
Source)

              at org.bouncycastle.tls.RecordStream.decodeAndVerify(Unknown
Source)

              at org.bouncycastle.tls.RecordStream.readRecord(Unknown
Source)

              at org.bouncycastle.tls.TlsProtocol.safeReadRecord(Unknown
Source)

              at org.bouncycastle.tls.TlsProtocol.blockForHandshake(Unknown
Source)

              at org.bouncycastle.tls.TlsServerProtocol.accept(Unknown
Source)

              at
com.oracle.test.TlsServerTest$ServerThread.run(TlsServerTest.java:62)
TlsServerTest.java (application/octet-stream, 2.3 KB) - not displayed