상속: TpmStructureBase, ISensitiveCompositeUnion
예제 #1
0
        /// <summary>
        /// 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
        /// </summary>
        /// <param name="keyParms"></param>
        /// <param name="publicParms"></param>
        /// <returns></returns>
        internal static ISensitiveCompositeUnion CreateSensitiveComposite(TpmPublic keyParms, out IPublicIdUnion publicParms)
        {
            TpmAlgId keyAlgId = keyParms.type;
            ISensitiveCompositeUnion newSens;

            // Create the asymmetric key
            if (keyAlgId != TpmAlgId.Rsa)
            {
                throw new Exception("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;
        }
예제 #2
0
 public Tpm2bPrivateKeyRsa(Tpm2bPrivateKeyRsa the_Tpm2bPrivateKeyRsa)
 {
     if((Object) the_Tpm2bPrivateKeyRsa == null ) throw new ArgumentException(Globs.GetResourceString("parmError"));
     buffer = the_Tpm2bPrivateKeyRsa.buffer;
 }