Exemplo n.º 1
0
        internal string GetSignatureKeyDerivationAlgorithm(SecurityToken token, SecureConversationVersion version)
        {
            if (token == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(token));
            }

            string derivationAlgorithm = SecurityUtils.GetKeyDerivationAlgorithm(version);

            if (SecurityUtils.IsSupportedAlgorithm(derivationAlgorithm, token))
            {
                return(derivationAlgorithm);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 2
0
        internal void GetKeyWrapAlgorithm(SecurityToken token, out string keyWrapAlgorithm, out XmlDictionaryString keyWrapAlgorithmDictionaryString)
        {
            if (token == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(token));
            }

            if (SecurityUtils.IsSupportedAlgorithm(DefaultSymmetricKeyWrapAlgorithm, token))
            {
                keyWrapAlgorithm = DefaultSymmetricKeyWrapAlgorithm;
                keyWrapAlgorithmDictionaryString = DefaultSymmetricKeyWrapAlgorithmDictionaryString;
            }
            else
            {
                keyWrapAlgorithm = DefaultAsymmetricKeyWrapAlgorithm;
                keyWrapAlgorithmDictionaryString = DefaultAsymmetricKeyWrapAlgorithmDictionaryString;
            }
        }
Exemplo n.º 3
0
        internal int GetSignatureKeyDerivationLength(SecurityToken token, SecureConversationVersion version)
        {
            if (token == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(token));
            }

            string derivationAlgorithm = SecurityUtils.GetKeyDerivationAlgorithm(version);

            if (SecurityUtils.IsSupportedAlgorithm(derivationAlgorithm, token))
            {
                if (DefaultSignatureKeyDerivationLength % 8 != 0)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(SR.Format(SR.Psha1KeyLengthInvalid, DefaultSignatureKeyDerivationLength)));
                }

                return(DefaultSignatureKeyDerivationLength / 8);
            }
            else
            {
                return(0);
            }
        }