11/*
22 * ConnectBot SSH Library
3- * Copyright 2025 Kenny Root
3+ * Copyright 2025-2026 Kenny Root
44 *
55 * Licensed under the Apache License, Version 2.0 (the "License");
66 * you may not use this file except in compliance with the License.
@@ -35,6 +35,8 @@ internal class ChaCha20Poly1305Cipher(private val key: ByteArray) : PacketAead {
3535 const val KEY_SIZE = 64
3636 const val TAG_SIZE = 16
3737 const val BLOCK_SIZE = 8
38+ const val KEYSPEC_ALGO = " ChaCha20"
39+ const val CIPHER_ALGO = " ChaCha20/None/NoPadding"
3840 }
3941
4042 override val tagLength: Int = TAG_SIZE
@@ -58,12 +60,12 @@ internal class ChaCha20Poly1305Cipher(private val key: ByteArray) : PacketAead {
5860 init {
5961 require(key.size == KEY_SIZE ) { " ChaCha20-Poly1305 requires 64 bytes of key material" }
6062
61- mainKeySpec = SecretKeySpec (key, 0 , 32 , " ChaCha20 " )
62- headerKeySpec = SecretKeySpec (key, 32 , 32 , " ChaCha20 " )
63+ mainKeySpec = SecretKeySpec (key, 0 , 32 , KEYSPEC_ALGO )
64+ headerKeySpec = SecretKeySpec (key, 32 , 32 , KEYSPEC_ALGO )
6365
64- headerCipher = Cipher .getInstance(" ChaCha20 " )
65- polyKeyCipher = Cipher .getInstance(" ChaCha20 " )
66- payloadCipher = Cipher .getInstance(" ChaCha20 " )
66+ headerCipher = Cipher .getInstance(CIPHER_ALGO )
67+ polyKeyCipher = Cipher .getInstance(CIPHER_ALGO )
68+ payloadCipher = Cipher .getInstance(CIPHER_ALGO )
6769 }
6870
6971 private fun updateNonce (seqNum : Long ) {
0 commit comments