Documentation Home
MySQL Internals Manual
Download this Manual
EPUB - 0.8Mb


MySQL Internals Manual  /  ...  /  Public Key Retrieval Example

14.12.4.2 Public Key Retrieval Example

  • set --default-authentication-plugin=sha256_password for the MySQL server:

    46 00 00 00 0a 35 2e 36    2e 37 2d 6c 6f 67 00 04    F....5.6.7-log..
    00 00 00 60 4a 57 38 26    2d 03 72 00 ff f7 08 02    ...`JW8&-.r.....
    00 3f 80 14 00 00 00 00    00 00 00 00 00 00 62 53    .?............bS
    42 4f 3a 09 15 5c 7b 17    27 39{73 68 61 32 35 36    BO:..\{.'9sha256
    5f 70 61 73 73 77 6f 72    64 00}                     _password.
    
  • set --default-auth=sha256_password for the MySQL client, don't provide it with the servers public-key and login with a user whose account uses sha256_password:

    9f 00 00 01 85 a6 3f 00    00 00 00 01 21 00 00 00    ......?.....!...
    00 00 00 00 00 00 00 00    00 00 00 00 00 00 00 00    ................
    00 00 00 00 73 68 61 32    35 36 00{01 01 73 68 61    ....sha256...sha
    32 35 36 5f 70 61 73 73    77 6f 72 64 00}65 03 5f    256_password.e._
    6f 73 05 4c 69 6e 75 78    0c 5f 63 6c 69 65 6e 74    os.Linux._client
    5f 6e 61 6d 65 08 6c 69    62 6d 79 73 71 6c 04 5f    _name.libmysql._
    70 69 64 05 31 36 30 38    30 0f 5f 63 6c 69 65 6e    pid.16080._clien
    74 5f 76 65 72 73 69 6f    6e 05 35 2e 36 2e 37 09    t_version.5.6.7.
    5f 70 6c 61 74 66 6f 72    6d 06 78 38 36 5f 36 34    _platform.x86_64
    0c 70 72 6f 67 72 61 6d    5f 6e 61 6d 65 05 6d 79    .program_name.my
    73 71 6c                                              sql
    
  • server sends a Protocol::AuthMoreData the public key:

    11 01 00 02 01 2d 2d 2d    2d 2d 42 45 47 49 4e 20    .....-----BEGIN
    50 55 42 4c 49 43 20 4b    45 59 2d 2d 2d 2d 2d 0a    PUBLIC KEY-----.
    4d 49 47 66 4d 41 30 47    43 53 71 47 53 49 62 33    MIGfMA0GCSqGSIb3
    44 51 45 42 41 51 55 41    41 34 47 4e 41 44 43 42    DQEBAQUAA4GNADCB
    69 51 4b 42 67 51 43 33    65 57 55 56 70 71 48 38    iQKBgQC3eWUVpqH8
    38 51 33 54 55 4a 34 48    44 41 48 64 37 65 65 7a    8Q3TUJ4HDAHd7eez
    0a 65 6e 51 6d 32 64 57    36 76 44 4e 38 7a 5a 64    .enQm2dW6vDN8zZd
    31 30 68 46 31 76 66 46    59 30 48 52 49 34 70 32    10hF1vfFY0HRI4p2
    4b 32 68 53 65 36 70 35    4c 30 75 64 73 76 5a 46    K2hSe6p5L0udsvZF
    65 35 68 34 4d 30 2f 4e    65 4f 36 41 54 5a 5a 56    e5h4M0/NeO6ATZZV
    34 0a 57 72 59 7a 4e 4b    37 34 72 78 59 34 52 32    4.WrYzNK74rxY4R2
    6b 46 39 47 7a 47 55 4c    67 74 50 69 54 71 75 67    kF9GzGULgtPiTqug
    48 64 77 44 4d 56 57 6c    73 52 76 57 31 47 76 39    HdwDMVWlsRvW1Gv9
    53 35 4e 6f 6c 77 48 42    69 59 6c 31 45 75 6d 62    S5NolwHBiYl1Eumb
    2f 4f 0a 67 2f 74 4d 65    77 57 30 32 72 33 6b 58    /O.g/tMewW02r3kX
    45 58 77 64 51 49 44 41    51 41 42 0a 2d 2d 2d 2d    EXwdQIDAQAB.----
    2d 45 4e 44 20 50 55 42    4c 49 43 20 4b 45 59 2d    -END PUBLIC KEY-
    2d 2d 2d 2d 0a                                        ----.
    
  • client sends back the encrypted key:

    80 00 00 03 57 4a bf 0c    19 ee f9 83 31 b7 42 28    ....WJ......1.B(
    a7 ea 95 38 e6 79 94 ee    2c 87 7d c2 09 99 a9 47    ...8.y..,.}....G
    3a 45 2d 75 74 97 42 8d    3b 2c 5b c4 9f 90 de 95    :E-ut.B.;,[.....
    e2 52 67 63 ec 4c fc f8    42 eb 9e b7 7e 8d d5 0c    .Rgc.L..B...~...
    6a a0 46 1a 2e db f9 ee    2c 65 45 ca 7e 8b 28 76    j.F.....,eE.~.(v
    0c 2f 62 65 5d 53 d7 20    d0 df 21 6f 85 03 8e 69    ./be]S. ..!o...i
    98 1c 27 e9 c0 70 5c 61    c8 84 3c e0 04 44 0f ac    ..'..p\a..<..D..
    4a 8c 96 39 d1 48 d7 d8    78 75 7a 69 c8 e5 67 e4    J..9.H..xuzi..g.
    91 70 8c 6c                                           .p.l
    
  • server is happy and sends back the OK_Packet:

    07 00 00 04 00 00 00 02    00 00 00                   ...........
    

User Comments
Sign Up Login You must be logged in to post a comment.