Tpm2Lib.TssObject.CreateSensitiveComposite C# (CSharp) Method

CreateSensitiveComposite() static private method

Create a new asymmetric key based on the parameters in keyParms. The resulting key data is returned in structures suitable for incorporation in a TPMT_PUBLIC and TPMS_SENSITIVE
static private CreateSensitiveComposite ( TpmPublic keyParms, IPublicIdUnion &publicParms ) : ISensitiveCompositeUnion
keyParms TpmPublic
publicParms IPublicIdUnion
return ISensitiveCompositeUnion
        internal static ISensitiveCompositeUnion CreateSensitiveComposite(TpmPublic keyParms, out IPublicIdUnion publicParms)
        {
            TpmAlgId keyAlgId = keyParms.type;
            ISensitiveCompositeUnion newSens;

            // Create the asymmetric key
            if (keyAlgId != TpmAlgId.Rsa)
            {
                Globs.Throw<ArgumentException>("Algorithm not supported");
            }

            var newKeyPair = new RawRsa((keyParms.parameters as RsaParms).keyBits);

            // Put the key bits into the required structure envelopes
            newSens = new Tpm2bPrivateKeyRsa(newKeyPair.Private);
            publicParms = new Tpm2bPublicKeyRsa(newKeyPair.Public);
            return newSens;
        }