Set Enveloped data version to 2 if ktri version not zero.
Initialize num properly.

PR#3289
PR#3345