Ejemplo n.º 1
0
        internal static SecurityToken ComputeProofKey(RequestSecurityToken rst, RequestSecurityTokenResponse rstr)
        {
            if (rstr.Entropy == null)
            {
                throw new NotSupportedException("RSTR entropy is null");
            }
            if (rst.Entropy == null)
            {
                throw new NotSupportedException("RST entropy is null");
            }

            int?keySizeInBits = rst.KeySizeInBits;
            int num           = keySizeInBits.HasValue ? keySizeInBits.GetValueOrDefault() : 0x400;

            if (rstr.KeySizeInBits.HasValue)
            {
                num = rstr.KeySizeInBits.Value;
            }

            return(new BinarySecretSecurityToken(
                       KeyGenerator.ComputeCombinedKey(
                           rst.Entropy.GetKeyBytes(),
                           rstr.Entropy.GetKeyBytes(),
                           num)));
        }