KMS + JWT is confusing and easily misused. This question is about pragmatics, so summary answers below, happy to expand on them but the details are intricate.
1) Is signing barely encryption of the hash of the content?
It is not.
2) In JWT case, if I hash the content of JWT and encrypt it and
put it in signature field, will it be correct signing?
It will not.
If you are using JWTs for authorization tokens, here's the short version of what you likely want to do:
- Use KMS to generate a 256 bit Data Key, in both encrypted and plaintext forms: https://docs.aws.amazon.com/kms/latest/APIReference/API_GenerateDataKey.html
- Save the encrypted form of the data key, along with the CMK key-id under which it was minted, in your database or with application configuration
- Use the 256 bit plaintext Data Key as the "secret" with your language platform's preferred JWT library to sign and validate JWTs.
- When your application restarts, get the encrypted Data Key from the database, call KMS Decrypt on it to get the plaintext version of the Data Key, and use as above for JWT signing and validation
Hope that helps.