Shaft Key Shear Stress
A key transmits torque between a shaft and a hub and is sized so it shears before the shaft does — a deliberate weak link.
The tangential force is F = T/r and the key shear stress is τ = F/(w·L). where T is the torque, r the shaft radius, w the key width and L the key length.
The torque acts at the shaft surface as a tangential force.
That force is carried in shear across the key’s side area.
Results
The shear stress must stay below the key material’s allowable. A longer or wider key reduces it; bearing on the keyway sides should also be checked.