Tpm2Lib.TssObject.CreateStorageParent C# (CSharp) Method

CreateStorageParent() public static method

Creates a *software* root key. The key will be random (not created from a seed). The key can be used as the root of a software hierarchy that can be translated into a duplication blob ready for import into a TPM. Depending on the type of key, the software root key can be a parent for other root keys that can comprise a migration group. The caller should specify necessary key parameters in Public.
public static CreateStorageParent ( TpmPublic keyParameters, AuthValue authVal ) : TssObject
keyParameters TpmPublic
authVal AuthValue
return TssObject
        public static TssObject CreateStorageParent(TpmPublic keyParameters, AuthValue authVal)
        {
            var newKey = new TssObject();
            // Create a new asymmetric key from the supplied parameters
            IPublicIdUnion publicId;
            ISensitiveCompositeUnion sensitiveData = CreateSensitiveComposite(keyParameters, out publicId);

            // fill in the public data
            newKey.publicPart = keyParameters.Copy();
            newKey.publicPart.unique = publicId;

            // Create the associated symmetric key 
            byte[] symmKey = Globs.GetRandomBytes(CryptoLib.DigestSize(keyParameters.nameAlg));
            // Fill in the fields for the symmetric private-part of the asymmetric key
            var sens = new Sensitive(authVal.AuthVal, symmKey, sensitiveData);
            newKey.sensitivePart = sens;

            // And return the new key
            return newKey;
        }