PKCS#8 fixes from stable branch.