Java 类org.bouncycastle.crypto.tls.AlertDescription 实例源码

项目:HAP-Java    文件:ChachaDecoder.java   
public byte[] decodeCiphertext(byte[] receivedMAC, byte[] additionalData, byte[] ciphertext)
throws IOException {

     KeyParameter macKey = initRecordMAC(decryptCipher);

     byte[] calculatedMAC = PolyKeyCreator.create(macKey, additionalData, ciphertext);

     if (!Arrays.constantTimeAreEqual(calculatedMAC, receivedMAC))
     {
         throw new TlsFatalAlert(AlertDescription.bad_record_mac);
     }

     byte[] output = new byte[ciphertext.length];
     decryptCipher.processBytes(ciphertext, 0, ciphertext.length, output, 0);

     return output;
 }
项目:bitbreeds-webrtc    文件:DtlsMuxStunTransport.java   
public void send(byte[] buf, int off, int len)
        throws IOException {
    if (len > getSendLimit()) {
        throw new TlsFatalAlert(AlertDescription.record_overflow);
    }
    DatagramPacket packet = new DatagramPacket(buf, off, len);
    socket.send(packet);
}