Is this Poisoning the World...?
She is the secret service’s trump card, a poison specialist, but also a young and cute girl with a sinister temperament. Contrary to her sweet and innocent appearance, she can complete any tasks without the slightest hesitation. One day because of an incomplete black magic, she was sent into the body of a girl who was deemed as a waste of resources. What kind of change will she bring to this continent?
A secret service agent and poison specialist from the modern world wakes up inside the body of a young girl imprisoned within a cage in a fantasy version of Ancient China.
She has access to the girl's memories as well as her own, and realises that the girl is Ning Xuemo, a duke's orphaned daughter who was engaged to a prince, but has subsequently been imprisoned due to an accusation of adultery, which is considered a capital offense.
The prince asks her if she's willing to confess to the crime she's been accused of, but while she confesses to other things, she denies having committed adultery and insists she was framed, so the prince calls for a "virginity-testing beast" to be wheeled out in another cage.
This is all within the first three chapters. I've skimmed the first twelve and haven't found the other plot points you mentioned yet, but I believe this is enough to show that this has a good chance of being the story you're looking for.