Наследование: TpmStructureBase, IPublicIdUnion
Пример #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 Tpm2bPublicKeyRsa(Tpm2bPublicKeyRsa the_Tpm2bPublicKeyRsa)
 {
     if((Object) the_Tpm2bPublicKeyRsa == null ) throw new ArgumentException(Globs.GetResourceString("parmError"));
     buffer = the_Tpm2bPublicKeyRsa.buffer;
 }