-
-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Database operation failed on mysql 8.0 #16
Comments
Need to implement caching_sha2_password auth plugin |
https://github.com/manyuanrong/deno_mysql/blob/master/src/auth.ts#L40 It looks like a good working above code. Why do you remain inactive this code?
Just In plugin mysql_native_password case, I tested it in mysql8.0. |
To achieve it requires multiple communications and server establishment negotiation, refer to #52 |
@magichim It's not a working code. I alos try it by uncommenting the code. SQL excution result will return in mess order. |
@wenjoy Can I know your mysql version? It might be under v8.0. It's right? |
@magichim It's 8.0.20. I'm also want to make it works on mysql 8.0, still in progress of learning on the new authentication of mysql. |
This issue has been stale. Post code with version
And I tried to uncomment the cachingSha2Password, and there will be some mismatched issue that can be easily fixed I think. What I dont understand is u guys mentioned I went through the official doc didn't see I'm note sure I resolve the problem u guys concerned. Let's talk a little more when u get some time. |
@wenjoy If we don't use ssl connection, it seems that we need to get the public key from the server first. |
I did not explore in depth, but I can refer to https://github.com/sidorares/node-mysql2/blob/master/lib/auth_plugins/caching_sha2_password.js |
@manyuanrong Thanks for refs. You're right. I got the public key in unsecure context. I digged slightly deeper, but I had to stop when try to encrypt the password with public key for lacks of such module in deno. At least I cant find a appropriate one. Any thoughts or suggestions? ref: denoland/deno#1891 |
@wenjoy I found the |
@manyuanrong Thanks. That helps a lot. I will continue with that. |
Since we only need to encrypt password, I quickly wrote one here (https://github.com/invisal/god-crypto). You can use as the following import { RSA } from "https://github.com/invisal/god-crypto/raw/master/mod.ts";
const publicKey = RSA.parseKey("public_key_that_mysql_send_to_you");
const xorPassword = xor(`${password}\0`, handshakePacket.seed);
await new SendPacket(RSA.encrypt(xorPassword, publicKey)); I tested it and it works. Useful Information |
@manyuanrong Thanks. I tried with I do get two methods, one is bridge to rust's I choose the later as it has none business of platform difference at all. And now seems we have extra option thanks @invisal . I would try to integrate that lib when I get time. |
@wenjoy Nice job. If you want to integrate, you can simply change a few line of code and it will work. In your import { RSA } from "https://deno.land/x/god_crypto@v0.2.0/mod.ts";
function encryptWithPublicKey(key: string, data: Uint8Array): Uint8Array {
const publicKey = RSA.parseKey(key);
return RSA.encrypt(data, publicKey);
} |
@invisal switched to |
The text was updated successfully, but these errors were encountered: