Make the door to the cockpit locked 1" steel, and tell the cockpit crew that if they open it for terrorists, no matter how many passengers they slash, they will be tried along with the terrorists.
Allow the crew to open it on their needs. Keep cockpit door locked at all times.
The cockpit doors, as I've seen, are pitiful. An anemic six-year old could kick them in.