File tree 1 file changed +5
-3
lines changed
1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -196,8 +196,9 @@ const initiateConnection = async (opts: ConnectionOptions) => {
196
196
'-----BEGIN PUBLIC KEY-----\n' +
197
197
publicKey . toString ( 'base64' ) +
198
198
'\n-----END PUBLIC KEY-----'
199
- const encryptedSharedSecret = publicEncrypt ( pk , sharedSecret )
200
- const encryptedVerifyToken = publicEncrypt ( pk , verifyToken )
199
+ const ePrms = { key : pk , padding : 1 } // RSA_PKCS1_PADDING
200
+ const encryptedSharedSecret = publicEncrypt ( ePrms , sharedSecret )
201
+ const encryptedVerifyToken = publicEncrypt ( ePrms , verifyToken )
201
202
// Send encryption response packet.
202
203
await conn . writePacket (
203
204
0x01 ,
@@ -212,7 +213,8 @@ const initiateConnection = async (opts: ConnectionOptions) => {
212
213
const ss = sharedSecret
213
214
conn . aesDecipher = createDecipheriv ( 'aes-128-cfb8' , ss , ss )
214
215
conn . aesCipher = createCipheriv ( 'aes-128-cfb8' , ss , ss )
215
- } ) ( ) . catch ( ( ) => {
216
+ } ) ( ) . catch ( e => {
217
+ console . error ( e )
216
218
conn . disconnectReason =
217
219
'{"text":"Failed to authenticate with Mojang servers!"}'
218
220
conn . close ( )
You can’t perform that action at this time.
0 commit comments