Is it possible dimension a braking resistor according to a specific stopping time for a DC motor?
Assuming that a DC motor is running at 1200rpm and there is a power
cut, the motor will stop in 40 seconds.

Apart from inertia, unpowered stopping time depends on the load, internal friction, windage and iron losses. These factors are not directly related to the effect of a braking resistor.
However if you know the operating power consumption (voltage x current) then you have the initial power loss without braking resistor. Assuming the power dissipated by the resistor is proportional to speed the same way as the other losses (doubtful, but probably not too far off), you can calculate the reduction in stopping time from the extra power extracted by the resistor.
The motor should generate a voltage slightly lower than the supply voltage, so initial braking power ~ = supply voltage 2 / (braking resistance + internal motor resistance), and braking time ~ = coasting time / (1 + braking power / operating power). eg. if the motor draws 1 A at 12 V and you add a 12 Ω braking resistor then it should stop in 'about' half the time.
Why might this not be exact? As the motor slows down the generated voltage reduces, which reduces braking power according to the square of voltage (and rpm in a PMDC motor). Windage is proportional to the cube of rpm, and iron losses are a composite of hysteresis and eddy current losses which range from exponential at high rpm to linear at low rpm. Friction occurs all the way down to zero rpm (and is ultimately the only reason an unloaded motor stops spinning). Any load will have its own curve which could be different again.