예제 #1
0
        protected void ValidateKeySize(GenericXmlSecurityToken issuedToken)
        {
            CommunicationObject.ThrowIfClosedOrNotOpen();
            ReadOnlyCollection <SecurityKey> issuedKeys = issuedToken.SecurityKeys;

            if (issuedKeys != null && issuedKeys.Count == 1)
            {
                SymmetricSecurityKey symmetricKey = issuedKeys[0] as SymmetricSecurityKey;
                if (symmetricKey != null)
                {
                    if (SecurityAlgorithmSuite.IsSymmetricKeyLengthSupported(symmetricKey.KeySize))
                    {
                        return;
                    }
                    else
                    {
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new SecurityNegotiationException(SR.Format(SR.InvalidIssuedTokenKeySize, symmetricKey.KeySize)));
                    }
                }
            }
            else
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new SecurityNegotiationException(SR.CannotObtainIssuedTokenKeySize));
            }
        }
예제 #2
0
 internal static void ValidateSymmetricKeyLength(int keyLength, SecurityAlgorithmSuite algorithmSuite)
 {
     if (!algorithmSuite.IsSymmetricKeyLengthSupported(keyLength))
     {
         throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperWarning(new ArgumentOutOfRangeException("algorithmSuite", System.ServiceModel.SR.GetString("UnsupportedKeyLength", new object[] { keyLength, algorithmSuite.ToString() })));
     }
     if ((keyLength % 8) != 0)
     {
         throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperWarning(new ArgumentOutOfRangeException("algorithmSuite", System.ServiceModel.SR.GetString("KeyLengthMustBeMultipleOfEight", new object[] { keyLength })));
     }
 }
예제 #3
0
 internal static void ValidateSymmetricKeyLength(int keyLength, SecurityAlgorithmSuite algorithmSuite)
 {
     if (!algorithmSuite.IsSymmetricKeyLengthSupported(keyLength))
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperWarning(new ArgumentOutOfRangeException("algorithmSuite",
                                                                                                     SR.GetString(SR.UnsupportedKeyLength, keyLength, algorithmSuite.ToString())));
     }
     if (keyLength % 8 != 0)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperWarning(new ArgumentOutOfRangeException("algorithmSuite",
                                                                                                     SR.GetString(SR.KeyLengthMustBeMultipleOfEight, keyLength)));
     }
 }
예제 #4
0
 internal static void ValidateSymmetricKeyLength(int keyLength, SecurityAlgorithmSuite algorithmSuite)
 {
     if (!algorithmSuite.IsSymmetricKeyLengthSupported(keyLength))
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperWarning(new ArgumentOutOfRangeException("algorithmSuite",
            SR.GetString(SR.UnsupportedKeyLength, keyLength, algorithmSuite.ToString())));
     }
     if (keyLength % 8 != 0)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperWarning(new ArgumentOutOfRangeException("algorithmSuite",
            SR.GetString(SR.KeyLengthMustBeMultipleOfEight, keyLength)));
     }
 }
 internal static void ValidateSymmetricKeyLength(int keyLength, SecurityAlgorithmSuite algorithmSuite)
 {
     if (!algorithmSuite.IsSymmetricKeyLengthSupported(keyLength))
     {
         throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperWarning(new ArgumentOutOfRangeException("algorithmSuite", System.ServiceModel.SR.GetString("UnsupportedKeyLength", new object[] { keyLength, algorithmSuite.ToString() })));
     }
     if ((keyLength % 8) != 0)
     {
         throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperWarning(new ArgumentOutOfRangeException("algorithmSuite", System.ServiceModel.SR.GetString("KeyLengthMustBeMultipleOfEight", new object[] { keyLength })));
     }
 }