| | | 1 | | // Licensed to the .NET Foundation under one or more agreements. |
| | | 2 | | // The .NET Foundation licenses this file to you under the MIT license. |
| | | 3 | | |
| | | 4 | | using System; |
| | | 5 | | using System.Collections.ObjectModel; |
| | | 6 | | using System.Xml; |
| | | 7 | | using CoreWCF.IdentityModel.Tokens; |
| | | 8 | | using CoreWCF.Security.Tokens; |
| | | 9 | | |
| | | 10 | | namespace CoreWCF.Security |
| | | 11 | | { |
| | | 12 | | public abstract class SecurityAlgorithmSuite |
| | | 13 | | { |
| | | 14 | | private static SecurityAlgorithmSuite s_basic256; |
| | | 15 | | private static SecurityAlgorithmSuite s_basic192; |
| | | 16 | | private static SecurityAlgorithmSuite s_basic128; |
| | | 17 | | private static SecurityAlgorithmSuite s_tripleDes; |
| | | 18 | | private static SecurityAlgorithmSuite s_basic256Rsa15; |
| | | 19 | | private static SecurityAlgorithmSuite s_basic192Rsa15; |
| | | 20 | | private static SecurityAlgorithmSuite s_basic128Rsa15; |
| | | 21 | | private static SecurityAlgorithmSuite s_tripleDesRsa15; |
| | | 22 | | private static SecurityAlgorithmSuite s_basic256Sha256; |
| | | 23 | | private static SecurityAlgorithmSuite s_basic192Sha256; |
| | | 24 | | private static SecurityAlgorithmSuite s_basic128Sha256; |
| | | 25 | | private static SecurityAlgorithmSuite s_tripleDesSha256; |
| | | 26 | | private static SecurityAlgorithmSuite s_basic256Sha256Rsa15; |
| | | 27 | | private static SecurityAlgorithmSuite s_basic192Sha256Rsa15; |
| | | 28 | | private static SecurityAlgorithmSuite s_basic128Sha256Rsa15; |
| | | 29 | | private static SecurityAlgorithmSuite s_tripleDesSha256Rsa15; |
| | | 30 | | |
| | | 31 | | internal static SecurityAlgorithmSuite KerberosDefault |
| | | 32 | | { |
| | | 33 | | get |
| | | 34 | | { |
| | | 35 | | return Basic128; |
| | | 36 | | } |
| | | 37 | | } |
| | | 38 | | public static SecurityAlgorithmSuite Default |
| | | 39 | | { |
| | | 40 | | get |
| | | 41 | | { |
| | | 42 | | return Basic256; |
| | | 43 | | } |
| | | 44 | | } |
| | | 45 | | |
| | | 46 | | public static SecurityAlgorithmSuite Basic256 |
| | | 47 | | { |
| | | 48 | | get |
| | | 49 | | { |
| | | 50 | | if (s_basic256 == null) |
| | | 51 | | { |
| | | 52 | | s_basic256 = new Basic256SecurityAlgorithmSuite(); |
| | | 53 | | } |
| | | 54 | | |
| | | 55 | | return s_basic256; |
| | | 56 | | } |
| | | 57 | | } |
| | | 58 | | public static SecurityAlgorithmSuite Basic192 |
| | | 59 | | { |
| | | 60 | | get |
| | | 61 | | { |
| | | 62 | | if (s_basic192 == null) |
| | | 63 | | { |
| | | 64 | | s_basic192 = new Basic192SecurityAlgorithmSuite(); |
| | | 65 | | } |
| | | 66 | | |
| | | 67 | | return s_basic192; |
| | | 68 | | } |
| | | 69 | | } |
| | | 70 | | public static SecurityAlgorithmSuite Basic128 |
| | | 71 | | { |
| | | 72 | | get |
| | | 73 | | { |
| | | 74 | | if (s_basic128 == null) |
| | | 75 | | { |
| | | 76 | | s_basic128 = new Basic128SecurityAlgorithmSuite(); |
| | | 77 | | } |
| | | 78 | | |
| | | 79 | | return s_basic128; |
| | | 80 | | } |
| | | 81 | | } |
| | | 82 | | public static SecurityAlgorithmSuite TripleDes |
| | | 83 | | { |
| | | 84 | | get |
| | | 85 | | { |
| | | 86 | | if (s_tripleDes == null) |
| | | 87 | | { |
| | | 88 | | s_tripleDes = new TripleDesSecurityAlgorithmSuite(); |
| | | 89 | | } |
| | | 90 | | |
| | | 91 | | return s_tripleDes; |
| | | 92 | | } |
| | | 93 | | } |
| | | 94 | | public static SecurityAlgorithmSuite Basic256Rsa15 |
| | | 95 | | { |
| | | 96 | | get |
| | | 97 | | { |
| | | 98 | | if (s_basic256Rsa15 == null) |
| | | 99 | | { |
| | | 100 | | s_basic256Rsa15 = new Basic256Rsa15SecurityAlgorithmSuite(); |
| | | 101 | | } |
| | | 102 | | |
| | | 103 | | return s_basic256Rsa15; |
| | | 104 | | } |
| | | 105 | | } |
| | | 106 | | public static SecurityAlgorithmSuite Basic192Rsa15 |
| | | 107 | | { |
| | | 108 | | get |
| | | 109 | | { |
| | | 110 | | if (s_basic192Rsa15 == null) |
| | | 111 | | { |
| | | 112 | | s_basic192Rsa15 = new Basic192Rsa15SecurityAlgorithmSuite(); |
| | | 113 | | } |
| | | 114 | | |
| | | 115 | | return s_basic192Rsa15; |
| | | 116 | | } |
| | | 117 | | } |
| | | 118 | | public static SecurityAlgorithmSuite Basic128Rsa15 |
| | | 119 | | { |
| | | 120 | | get |
| | | 121 | | { |
| | | 122 | | if (s_basic128Rsa15 == null) |
| | | 123 | | { |
| | | 124 | | s_basic128Rsa15 = new Basic128Rsa15SecurityAlgorithmSuite(); |
| | | 125 | | } |
| | | 126 | | |
| | | 127 | | return s_basic128Rsa15; |
| | | 128 | | } |
| | | 129 | | } |
| | | 130 | | public static SecurityAlgorithmSuite TripleDesRsa15 |
| | | 131 | | { |
| | | 132 | | get |
| | | 133 | | { |
| | | 134 | | if (s_tripleDesRsa15 == null) |
| | | 135 | | { |
| | | 136 | | s_tripleDesRsa15 = new TripleDesRsa15SecurityAlgorithmSuite(); |
| | | 137 | | } |
| | | 138 | | |
| | | 139 | | return s_tripleDesRsa15; |
| | | 140 | | } |
| | | 141 | | } |
| | | 142 | | |
| | | 143 | | public static SecurityAlgorithmSuite Basic256Sha256 |
| | | 144 | | { |
| | | 145 | | get |
| | | 146 | | { |
| | | 147 | | if (s_basic256Sha256 == null) |
| | | 148 | | { |
| | | 149 | | s_basic256Sha256 = new Basic256Sha256SecurityAlgorithmSuite(); |
| | | 150 | | } |
| | | 151 | | |
| | | 152 | | return s_basic256Sha256; |
| | | 153 | | } |
| | | 154 | | } |
| | | 155 | | public static SecurityAlgorithmSuite Basic192Sha256 |
| | | 156 | | { |
| | | 157 | | get |
| | | 158 | | { |
| | | 159 | | if (s_basic192Sha256 == null) |
| | | 160 | | { |
| | | 161 | | s_basic192Sha256 = new Basic192Sha256SecurityAlgorithmSuite(); |
| | | 162 | | } |
| | | 163 | | |
| | | 164 | | return s_basic192Sha256; |
| | | 165 | | } |
| | | 166 | | } |
| | | 167 | | public static SecurityAlgorithmSuite Basic128Sha256 |
| | | 168 | | { |
| | | 169 | | get |
| | | 170 | | { |
| | | 171 | | if (s_basic128Sha256 == null) |
| | | 172 | | { |
| | | 173 | | s_basic128Sha256 = new Basic128Sha256SecurityAlgorithmSuite(); |
| | | 174 | | } |
| | | 175 | | |
| | | 176 | | return s_basic128Sha256; |
| | | 177 | | } |
| | | 178 | | } |
| | | 179 | | public static SecurityAlgorithmSuite TripleDesSha256 |
| | | 180 | | { |
| | | 181 | | get |
| | | 182 | | { |
| | | 183 | | if (s_tripleDesSha256 == null) |
| | | 184 | | { |
| | | 185 | | s_tripleDesSha256 = new TripleDesSha256SecurityAlgorithmSuite(); |
| | | 186 | | } |
| | | 187 | | |
| | | 188 | | return s_tripleDesSha256; |
| | | 189 | | } |
| | | 190 | | } |
| | | 191 | | public static SecurityAlgorithmSuite Basic256Sha256Rsa15 |
| | | 192 | | { |
| | | 193 | | get |
| | | 194 | | { |
| | | 195 | | if (s_basic256Sha256Rsa15 == null) |
| | | 196 | | { |
| | | 197 | | s_basic256Sha256Rsa15 = new Basic256Sha256Rsa15SecurityAlgorithmSuite(); |
| | | 198 | | } |
| | | 199 | | |
| | | 200 | | return s_basic256Sha256Rsa15; |
| | | 201 | | } |
| | | 202 | | } |
| | | 203 | | public static SecurityAlgorithmSuite Basic192Sha256Rsa15 |
| | | 204 | | { |
| | | 205 | | get |
| | | 206 | | { |
| | | 207 | | if (s_basic192Sha256Rsa15 == null) |
| | | 208 | | { |
| | | 209 | | s_basic192Sha256Rsa15 = new Basic192Sha256Rsa15SecurityAlgorithmSuite(); |
| | | 210 | | } |
| | | 211 | | |
| | | 212 | | return s_basic192Sha256Rsa15; |
| | | 213 | | } |
| | | 214 | | } |
| | | 215 | | public static SecurityAlgorithmSuite Basic128Sha256Rsa15 |
| | | 216 | | { |
| | | 217 | | get |
| | | 218 | | { |
| | | 219 | | if (s_basic128Sha256Rsa15 == null) |
| | | 220 | | { |
| | | 221 | | s_basic128Sha256Rsa15 = new Basic128Sha256Rsa15SecurityAlgorithmSuite(); |
| | | 222 | | } |
| | | 223 | | |
| | | 224 | | return s_basic128Sha256Rsa15; |
| | | 225 | | } |
| | | 226 | | } |
| | | 227 | | public static SecurityAlgorithmSuite TripleDesSha256Rsa15 |
| | | 228 | | { |
| | | 229 | | get |
| | | 230 | | { |
| | | 231 | | if (s_tripleDesSha256Rsa15 == null) |
| | | 232 | | { |
| | | 233 | | s_tripleDesSha256Rsa15 = new TripleDesSha256Rsa15SecurityAlgorithmSuite(); |
| | | 234 | | } |
| | | 235 | | |
| | | 236 | | return s_tripleDesSha256Rsa15; |
| | | 237 | | } |
| | | 238 | | } |
| | | 239 | | |
| | | 240 | | public abstract string DefaultCanonicalizationAlgorithm { get; } |
| | | 241 | | public abstract string DefaultDigestAlgorithm { get; } |
| | | 242 | | public abstract string DefaultEncryptionAlgorithm { get; } |
| | | 243 | | public abstract int DefaultEncryptionKeyDerivationLength { get; } |
| | | 244 | | public abstract string DefaultSymmetricKeyWrapAlgorithm { get; } |
| | | 245 | | public abstract string DefaultAsymmetricKeyWrapAlgorithm { get; } |
| | | 246 | | public abstract string DefaultSymmetricSignatureAlgorithm { get; } |
| | | 247 | | public abstract string DefaultAsymmetricSignatureAlgorithm { get; } |
| | | 248 | | public abstract int DefaultSignatureKeyDerivationLength { get; } |
| | | 249 | | public abstract int DefaultSymmetricKeyLength { get; } |
| | | 250 | | |
| | | 251 | | internal virtual XmlDictionaryString DefaultCanonicalizationAlgorithmDictionaryString { get { return null; } } |
| | | 252 | | internal virtual XmlDictionaryString DefaultDigestAlgorithmDictionaryString { get { return null; } } |
| | | 253 | | internal virtual XmlDictionaryString DefaultEncryptionAlgorithmDictionaryString { get { return null; } } |
| | | 254 | | internal virtual XmlDictionaryString DefaultSymmetricKeyWrapAlgorithmDictionaryString { get { return null; } } |
| | | 255 | | internal virtual XmlDictionaryString DefaultAsymmetricKeyWrapAlgorithmDictionaryString { get { return null; } } |
| | | 256 | | internal virtual XmlDictionaryString DefaultSymmetricSignatureAlgorithmDictionaryString { get { return null; } } |
| | | 257 | | internal virtual XmlDictionaryString DefaultAsymmetricSignatureAlgorithmDictionaryString { get { return null; } |
| | | 258 | | |
| | | 259 | | protected SecurityAlgorithmSuite() { } |
| | | 260 | | |
| | | 261 | | public virtual bool IsCanonicalizationAlgorithmSupported(string algorithm) { return algorithm == DefaultCanonica |
| | | 262 | | public virtual bool IsDigestAlgorithmSupported(string algorithm) { return algorithm == DefaultDigestAlgorithm; } |
| | | 263 | | public virtual bool IsEncryptionAlgorithmSupported(string algorithm) { return algorithm == DefaultEncryptionAlgo |
| | | 264 | | public virtual bool IsEncryptionKeyDerivationAlgorithmSupported(string algorithm) { return (algorithm == Securit |
| | | 265 | | public virtual bool IsSymmetricKeyWrapAlgorithmSupported(string algorithm) { return algorithm == DefaultSymmetri |
| | | 266 | | public virtual bool IsAsymmetricKeyWrapAlgorithmSupported(string algorithm) { return algorithm == DefaultAsymmet |
| | | 267 | | public virtual bool IsSymmetricSignatureAlgorithmSupported(string algorithm) { return algorithm == DefaultSymmet |
| | | 268 | | public virtual bool IsAsymmetricSignatureAlgorithmSupported(string algorithm) { return algorithm == DefaultAsymm |
| | | 269 | | public virtual bool IsSignatureKeyDerivationAlgorithmSupported(string algorithm) { return (algorithm == Security |
| | | 270 | | public abstract bool IsSymmetricKeyLengthSupported(int length); |
| | | 271 | | public abstract bool IsAsymmetricKeyLengthSupported(int length); |
| | | 272 | | |
| | | 273 | | internal static bool IsRsaSHA256(SecurityAlgorithmSuite suite) |
| | | 274 | | { |
| | | 275 | | if (suite == null) |
| | | 276 | | { |
| | | 277 | | return false; |
| | | 278 | | } |
| | | 279 | | |
| | | 280 | | return (suite == Basic128Sha256 || suite == Basic128Sha256Rsa15 || suite == Basic192Sha256 || suite == Basic |
| | | 281 | | suite == Basic256Sha256 || suite == Basic256Sha256Rsa15 || suite == TripleDesSha256 || suite == TripleDe |
| | | 282 | | } |
| | | 283 | | |
| | | 284 | | internal string GetEncryptionKeyDerivationAlgorithm(SecurityToken token, SecureConversationVersion version) |
| | | 285 | | { |
| | | 286 | | if (token == null) |
| | | 287 | | { |
| | | 288 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(token)); |
| | | 289 | | } |
| | | 290 | | |
| | | 291 | | string derivationAlgorithm = SecurityUtils.GetKeyDerivationAlgorithm(version); |
| | | 292 | | if (SecurityUtils.IsSupportedAlgorithm(derivationAlgorithm, token)) |
| | | 293 | | { |
| | | 294 | | return derivationAlgorithm; |
| | | 295 | | } |
| | | 296 | | else |
| | | 297 | | { |
| | | 298 | | return null; |
| | | 299 | | } |
| | | 300 | | } |
| | | 301 | | |
| | | 302 | | internal int GetEncryptionKeyDerivationLength(SecurityToken token, SecureConversationVersion version) |
| | | 303 | | { |
| | | 304 | | if (token == null) |
| | | 305 | | { |
| | | 306 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(token)); |
| | | 307 | | } |
| | | 308 | | |
| | | 309 | | string derivationAlgorithm = SecurityUtils.GetKeyDerivationAlgorithm(version); |
| | | 310 | | if (SecurityUtils.IsSupportedAlgorithm(derivationAlgorithm, token)) |
| | | 311 | | { |
| | | 312 | | if (DefaultEncryptionKeyDerivationLength % 8 != 0) |
| | | 313 | | { |
| | | 314 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(SR.Format(SR.Psha1Ke |
| | | 315 | | } |
| | | 316 | | |
| | | 317 | | return DefaultEncryptionKeyDerivationLength / 8; |
| | | 318 | | } |
| | | 319 | | else |
| | | 320 | | { |
| | | 321 | | return 0; |
| | | 322 | | } |
| | | 323 | | } |
| | | 324 | | |
| | | 325 | | internal void GetKeyWrapAlgorithm(SecurityToken token, out string keyWrapAlgorithm, out XmlDictionaryString keyW |
| | | 326 | | { |
| | | 327 | | if (token == null) |
| | | 328 | | { |
| | | 329 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(token)); |
| | | 330 | | } |
| | | 331 | | |
| | | 332 | | if (SecurityUtils.IsSupportedAlgorithm(DefaultSymmetricKeyWrapAlgorithm, token)) |
| | | 333 | | { |
| | | 334 | | keyWrapAlgorithm = DefaultSymmetricKeyWrapAlgorithm; |
| | | 335 | | keyWrapAlgorithmDictionaryString = DefaultSymmetricKeyWrapAlgorithmDictionaryString; |
| | | 336 | | } |
| | | 337 | | else |
| | | 338 | | { |
| | | 339 | | keyWrapAlgorithm = DefaultAsymmetricKeyWrapAlgorithm; |
| | | 340 | | keyWrapAlgorithmDictionaryString = DefaultAsymmetricKeyWrapAlgorithmDictionaryString; |
| | | 341 | | } |
| | | 342 | | } |
| | | 343 | | |
| | | 344 | | internal void GetSignatureAlgorithmAndKey(SecurityToken token, out string signatureAlgorithm, out SecurityKey ke |
| | | 345 | | { |
| | | 346 | | ReadOnlyCollection<SecurityKey> keys = token.SecurityKeys; |
| | | 347 | | if (keys == null || keys.Count == 0) |
| | | 348 | | { |
| | | 349 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.Format(SR.Sig |
| | | 350 | | } |
| | | 351 | | |
| | | 352 | | for (int i = 0; i < keys.Count; i++) |
| | | 353 | | { |
| | | 354 | | if (keys[i].IsSupportedAlgorithm(DefaultSymmetricSignatureAlgorithm)) |
| | | 355 | | { |
| | | 356 | | signatureAlgorithm = DefaultSymmetricSignatureAlgorithm; |
| | | 357 | | signatureAlgorithmDictionaryString = DefaultSymmetricSignatureAlgorithmDictionaryString; |
| | | 358 | | key = keys[i]; |
| | | 359 | | return; |
| | | 360 | | } |
| | | 361 | | else if (keys[i].IsSupportedAlgorithm(DefaultAsymmetricSignatureAlgorithm)) |
| | | 362 | | { |
| | | 363 | | signatureAlgorithm = DefaultAsymmetricSignatureAlgorithm; |
| | | 364 | | signatureAlgorithmDictionaryString = DefaultAsymmetricSignatureAlgorithmDictionaryString; |
| | | 365 | | key = keys[i]; |
| | | 366 | | return; |
| | | 367 | | } |
| | | 368 | | } |
| | | 369 | | |
| | | 370 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.Format(SR.Signing |
| | | 371 | | } |
| | | 372 | | |
| | | 373 | | internal string GetSignatureKeyDerivationAlgorithm(SecurityToken token, SecureConversationVersion version) |
| | | 374 | | { |
| | | 375 | | if (token == null) |
| | | 376 | | { |
| | | 377 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(token)); |
| | | 378 | | } |
| | | 379 | | |
| | | 380 | | string derivationAlgorithm = SecurityUtils.GetKeyDerivationAlgorithm(version); |
| | | 381 | | if (SecurityUtils.IsSupportedAlgorithm(derivationAlgorithm, token)) |
| | | 382 | | { |
| | | 383 | | return derivationAlgorithm; |
| | | 384 | | } |
| | | 385 | | else |
| | | 386 | | { |
| | | 387 | | return null; |
| | | 388 | | } |
| | | 389 | | } |
| | | 390 | | |
| | | 391 | | internal int GetSignatureKeyDerivationLength(SecurityToken token, SecureConversationVersion version) |
| | | 392 | | { |
| | | 393 | | if (token == null) |
| | | 394 | | { |
| | | 395 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(token)); |
| | | 396 | | } |
| | | 397 | | |
| | | 398 | | string derivationAlgorithm = SecurityUtils.GetKeyDerivationAlgorithm(version); |
| | | 399 | | if (SecurityUtils.IsSupportedAlgorithm(derivationAlgorithm, token)) |
| | | 400 | | { |
| | | 401 | | if (DefaultSignatureKeyDerivationLength % 8 != 0) |
| | | 402 | | { |
| | | 403 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(SR.Format(SR.Psha1Ke |
| | | 404 | | } |
| | | 405 | | |
| | | 406 | | return DefaultSignatureKeyDerivationLength / 8; |
| | | 407 | | } |
| | | 408 | | else |
| | | 409 | | { |
| | | 410 | | return 0; |
| | | 411 | | } |
| | | 412 | | } |
| | | 413 | | |
| | | 414 | | internal void EnsureAcceptableSymmetricSignatureAlgorithm(string algorithm) |
| | | 415 | | { |
| | | 416 | | if (!IsSymmetricSignatureAlgorithmSupported(algorithm)) |
| | | 417 | | { |
| | | 418 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MessageSecurityException(SR.Format(SR.Suit |
| | | 419 | | algorithm, "SymmetricSignature", this))); |
| | | 420 | | } |
| | | 421 | | } |
| | | 422 | | |
| | | 423 | | internal void EnsureAcceptableSignatureKeySize(SecurityKey securityKey, SecurityToken token) |
| | | 424 | | { |
| | | 425 | | if (securityKey is AsymmetricSecurityKey asymmetricSecurityKey) |
| | | 426 | | { |
| | | 427 | | if (!IsAsymmetricKeyLengthSupported(asymmetricSecurityKey.KeySize)) |
| | | 428 | | { |
| | | 429 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MessageSecurityException( |
| | | 430 | | SR.Format(SR.TokenDoesNotMeetKeySizeRequirements, this, token, asymmetricSecurityKey.KeySize))); |
| | | 431 | | } |
| | | 432 | | } |
| | | 433 | | else |
| | | 434 | | { |
| | | 435 | | SymmetricSecurityKey symmetricSecurityKey = securityKey as SymmetricSecurityKey; |
| | | 436 | | if (symmetricSecurityKey == null) |
| | | 437 | | { |
| | | 438 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.Format(SR |
| | | 439 | | } |
| | | 440 | | EnsureAcceptableSignatureSymmetricKeySize(symmetricSecurityKey, token); |
| | | 441 | | } |
| | | 442 | | } |
| | | 443 | | |
| | | 444 | | //// Ensure acceptable signing symmetric key. |
| | | 445 | | //// 1) if derived key, validate derived key against DefaultSignatureKeyDerivationLength and validate |
| | | 446 | | //// source key against DefaultSymmetricKeyLength |
| | | 447 | | //// 2) if not derived key, validate key against DefaultSymmetricKeyLength |
| | | 448 | | internal void EnsureAcceptableSignatureSymmetricKeySize(SymmetricSecurityKey securityKey, SecurityToken token) |
| | | 449 | | { |
| | | 450 | | int keySize; |
| | | 451 | | if (token is DerivedKeySecurityToken dkt) |
| | | 452 | | { |
| | | 453 | | token = dkt.TokenToDerive; |
| | | 454 | | keySize = ((SymmetricSecurityKey)token.SecurityKeys[0]).KeySize; |
| | | 455 | | |
| | | 456 | | // doing special case for derived key token signing length since |
| | | 457 | | // the sending side doesn't honor the algorithm suite. It used the DefaultSignatureKeyDerivationLength i |
| | | 458 | | if (dkt.SecurityKeys[0].KeySize < DefaultSignatureKeyDerivationLength) |
| | | 459 | | { |
| | | 460 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MessageSecurityException( |
| | | 461 | | SR.Format(SR.TokenDoesNotMeetKeySizeRequirements, this, dkt, dkt.SecurityKeys[0].KeySize))); |
| | | 462 | | } |
| | | 463 | | } |
| | | 464 | | else |
| | | 465 | | { |
| | | 466 | | keySize = securityKey.KeySize; |
| | | 467 | | } |
| | | 468 | | |
| | | 469 | | if (!IsSymmetricKeyLengthSupported(keySize)) |
| | | 470 | | { |
| | | 471 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MessageSecurityException( |
| | | 472 | | SR.Format(SR.TokenDoesNotMeetKeySizeRequirements, this, token, keySize))); |
| | | 473 | | } |
| | | 474 | | } |
| | | 475 | | |
| | | 476 | | //// Ensure acceptable decrypting symmetric key. |
| | | 477 | | //// 1) if derived key, validate derived key against DefaultEncryptionKeyDerivationLength and validate |
| | | 478 | | //// source key against DefaultSymmetricKeyLength |
| | | 479 | | //// 2) if not derived key, validate key against DefaultSymmetricKeyLength |
| | | 480 | | //internal void EnsureAcceptableDecryptionSymmetricKeySize(SymmetricSecurityKey securityKey, SecurityToken token |
| | | 481 | | //{ |
| | | 482 | | // int keySize; |
| | | 483 | | // DerivedKeySecurityToken dkt = token as DerivedKeySecurityToken; |
| | | 484 | | // if (dkt != null) |
| | | 485 | | // { |
| | | 486 | | // token = dkt.TokenToDerive; |
| | | 487 | | // keySize = ((SymmetricSecurityKey)token.SecurityKeys[0]).KeySize; |
| | | 488 | | |
| | | 489 | | // // doing special case for derived key token signing length since |
| | | 490 | | // // the sending side doesn't honor the algorithm suite. It used the DefaultSignatureKeyDerivationLength |
| | | 491 | | // if (dkt.SecurityKeys[0].KeySize < this.DefaultEncryptionKeyDerivationLength) |
| | | 492 | | // { |
| | | 493 | | // throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MessageSecurityException( |
| | | 494 | | // SR.Format(SR.TokenDoesNotMeetKeySizeRequirements, this, dkt, dkt.SecurityKeys[0].KeySize))); |
| | | 495 | | // } |
| | | 496 | | // } |
| | | 497 | | // else |
| | | 498 | | // { |
| | | 499 | | // keySize = securityKey.KeySize; |
| | | 500 | | // } |
| | | 501 | | |
| | | 502 | | // if (!IsSymmetricKeyLengthSupported(keySize)) |
| | | 503 | | // { |
| | | 504 | | // throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MessageSecurityException( |
| | | 505 | | // SR.Format(SR.TokenDoesNotMeetKeySizeRequirements, this, token, keySize))); |
| | | 506 | | // } |
| | | 507 | | //} |
| | | 508 | | |
| | | 509 | | internal void EnsureAcceptableSignatureAlgorithm(SecurityKey verificationKey, string algorithm) |
| | | 510 | | { |
| | | 511 | | if (verificationKey is InMemorySymmetricSecurityKey symmeticKey) |
| | | 512 | | { |
| | | 513 | | EnsureAcceptableSymmetricSignatureAlgorithm(algorithm); |
| | | 514 | | } |
| | | 515 | | else |
| | | 516 | | { |
| | | 517 | | if (!(verificationKey is AsymmetricSecurityKey asymmetricKey)) |
| | | 518 | | { |
| | | 519 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.Format(SR |
| | | 520 | | } |
| | | 521 | | |
| | | 522 | | EnsureAcceptableAsymmetricSignatureAlgorithm(algorithm); |
| | | 523 | | } |
| | | 524 | | } |
| | | 525 | | |
| | | 526 | | internal void EnsureAcceptableAsymmetricSignatureAlgorithm(string algorithm) |
| | | 527 | | { |
| | | 528 | | if (!IsAsymmetricSignatureAlgorithmSupported(algorithm)) |
| | | 529 | | { |
| | | 530 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MessageSecurityException(SR.Format(SR.Suit |
| | | 531 | | algorithm, "AsymmetricSignature", this))); |
| | | 532 | | } |
| | | 533 | | } |
| | | 534 | | |
| | | 535 | | internal void EnsureAcceptableKeyWrapAlgorithm(string algorithm, bool isAsymmetric) |
| | | 536 | | { |
| | | 537 | | if (isAsymmetric) |
| | | 538 | | { |
| | | 539 | | if (!IsAsymmetricKeyWrapAlgorithmSupported(algorithm)) |
| | | 540 | | { |
| | | 541 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MessageSecurityException(SR.Format(SR. |
| | | 542 | | algorithm, "AsymmetricKeyWrap", this))); |
| | | 543 | | } |
| | | 544 | | } |
| | | 545 | | else |
| | | 546 | | { |
| | | 547 | | if (!IsSymmetricKeyWrapAlgorithmSupported(algorithm)) |
| | | 548 | | { |
| | | 549 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MessageSecurityException(SR.Format(SR. |
| | | 550 | | algorithm, "SymmetricKeyWrap", this))); |
| | | 551 | | } |
| | | 552 | | } |
| | | 553 | | } |
| | | 554 | | |
| | | 555 | | //internal void EnsureAcceptableEncryptionAlgorithm(string algorithm) |
| | | 556 | | //{ |
| | | 557 | | // if (!IsEncryptionAlgorithmSupported(algorithm)) |
| | | 558 | | // { |
| | | 559 | | // throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MessageSecurityException(SR.Format(SR.Su |
| | | 560 | | // algorithm, "Encryption", this))); |
| | | 561 | | // } |
| | | 562 | | //} |
| | | 563 | | |
| | | 564 | | //internal void EnsureAcceptableSignatureKeyDerivationAlgorithm(string algorithm) |
| | | 565 | | //{ |
| | | 566 | | // if (!IsSignatureKeyDerivationAlgorithmSupported(algorithm)) |
| | | 567 | | // { |
| | | 568 | | // throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MessageSecurityException(SR.Format(SR.Su |
| | | 569 | | // algorithm, "SignatureKeyDerivation", this))); |
| | | 570 | | // } |
| | | 571 | | //} |
| | | 572 | | |
| | | 573 | | //internal void EnsureAcceptableEncryptionKeyDerivationAlgorithm(string algorithm) |
| | | 574 | | //{ |
| | | 575 | | // if (!IsEncryptionKeyDerivationAlgorithmSupported(algorithm)) |
| | | 576 | | // { |
| | | 577 | | // throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MessageSecurityException(SR.Format(SR.Su |
| | | 578 | | // algorithm, "EncryptionKeyDerivation", this))); |
| | | 579 | | // } |
| | | 580 | | //} |
| | | 581 | | |
| | | 582 | | internal void EnsureAcceptableDigestAlgorithm(string algorithm) |
| | | 583 | | { |
| | | 584 | | if (!IsDigestAlgorithmSupported(algorithm)) |
| | | 585 | | { |
| | | 586 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MessageSecurityException(SR.Format(SR.Suit |
| | | 587 | | algorithm, "Digest", this))); |
| | | 588 | | } |
| | | 589 | | } |
| | | 590 | | } |
| | | 591 | | |
| | | 592 | | public class Basic256SecurityAlgorithmSuite : SecurityAlgorithmSuite |
| | | 593 | | { |
| | | 594 | | public Basic256SecurityAlgorithmSuite() : base() { } |
| | | 595 | | |
| | | 596 | | public override string DefaultCanonicalizationAlgorithm { get { return DefaultCanonicalizationAlgorithmDictionar |
| | | 597 | | public override string DefaultDigestAlgorithm { get { return DefaultDigestAlgorithmDictionaryString.Value; } } |
| | | 598 | | public override string DefaultEncryptionAlgorithm { get { return DefaultEncryptionAlgorithmDictionaryString.Valu |
| | | 599 | | public override int DefaultEncryptionKeyDerivationLength { get { return 256; } } |
| | | 600 | | public override string DefaultSymmetricKeyWrapAlgorithm { get { return DefaultSymmetricKeyWrapAlgorithmDictionar |
| | | 601 | | public override string DefaultAsymmetricKeyWrapAlgorithm { get { return DefaultAsymmetricKeyWrapAlgorithmDiction |
| | | 602 | | public override string DefaultSymmetricSignatureAlgorithm { get { return DefaultSymmetricSignatureAlgorithmDicti |
| | | 603 | | public override string DefaultAsymmetricSignatureAlgorithm { get { return DefaultAsymmetricSignatureAlgorithmDic |
| | | 604 | | public override int DefaultSignatureKeyDerivationLength { get { return 192; } } |
| | | 605 | | public override int DefaultSymmetricKeyLength { get { return 256; } } |
| | | 606 | | public override bool IsSymmetricKeyLengthSupported(int length) { return length == 256; } |
| | | 607 | | public override bool IsAsymmetricKeyLengthSupported(int length) { return length >= 1024 && length <= 4096; } |
| | | 608 | | |
| | | 609 | | internal override XmlDictionaryString DefaultCanonicalizationAlgorithmDictionaryString { get { return XD.Securit |
| | | 610 | | internal override XmlDictionaryString DefaultDigestAlgorithmDictionaryString { get { return XD.SecurityAlgorithm |
| | | 611 | | internal override XmlDictionaryString DefaultEncryptionAlgorithmDictionaryString { get { return XD.SecurityAlgor |
| | | 612 | | internal override XmlDictionaryString DefaultSymmetricKeyWrapAlgorithmDictionaryString { get { return XD.Securit |
| | | 613 | | internal override XmlDictionaryString DefaultAsymmetricKeyWrapAlgorithmDictionaryString { get { return XD.Securi |
| | | 614 | | internal override XmlDictionaryString DefaultSymmetricSignatureAlgorithmDictionaryString { get { return XD.Secur |
| | | 615 | | internal override XmlDictionaryString DefaultAsymmetricSignatureAlgorithmDictionaryString { get { return XD.Secu |
| | | 616 | | |
| | | 617 | | public override string ToString() |
| | | 618 | | { |
| | | 619 | | return "Basic256"; |
| | | 620 | | } |
| | | 621 | | } |
| | | 622 | | |
| | | 623 | | public class Basic192SecurityAlgorithmSuite : SecurityAlgorithmSuite |
| | | 624 | | { |
| | | 625 | | public Basic192SecurityAlgorithmSuite() : base() { } |
| | | 626 | | |
| | | 627 | | public override string DefaultCanonicalizationAlgorithm { get { return DefaultCanonicalizationAlgorithmDictionar |
| | | 628 | | public override string DefaultDigestAlgorithm { get { return DefaultDigestAlgorithmDictionaryString.Value; } } |
| | | 629 | | public override string DefaultEncryptionAlgorithm { get { return DefaultEncryptionAlgorithmDictionaryString.Valu |
| | | 630 | | public override int DefaultEncryptionKeyDerivationLength { get { return 192; } } |
| | | 631 | | public override string DefaultSymmetricKeyWrapAlgorithm { get { return DefaultSymmetricKeyWrapAlgorithmDictionar |
| | | 632 | | public override string DefaultAsymmetricKeyWrapAlgorithm { get { return DefaultAsymmetricKeyWrapAlgorithmDiction |
| | | 633 | | public override string DefaultSymmetricSignatureAlgorithm { get { return DefaultSymmetricSignatureAlgorithmDicti |
| | | 634 | | public override string DefaultAsymmetricSignatureAlgorithm { get { return DefaultAsymmetricSignatureAlgorithmDic |
| | | 635 | | public override int DefaultSignatureKeyDerivationLength { get { return 192; } } |
| | | 636 | | public override int DefaultSymmetricKeyLength { get { return 192; } } |
| | | 637 | | public override bool IsSymmetricKeyLengthSupported(int length) { return length >= 192 && length <= 256; } |
| | | 638 | | public override bool IsAsymmetricKeyLengthSupported(int length) { return length >= 1024 && length <= 4096; } |
| | | 639 | | |
| | | 640 | | internal override XmlDictionaryString DefaultCanonicalizationAlgorithmDictionaryString { get { return XD.Securit |
| | | 641 | | internal override XmlDictionaryString DefaultDigestAlgorithmDictionaryString { get { return XD.SecurityAlgorithm |
| | | 642 | | internal override XmlDictionaryString DefaultEncryptionAlgorithmDictionaryString { get { return XD.SecurityAlgor |
| | | 643 | | internal override XmlDictionaryString DefaultSymmetricKeyWrapAlgorithmDictionaryString { get { return XD.Securit |
| | | 644 | | internal override XmlDictionaryString DefaultAsymmetricKeyWrapAlgorithmDictionaryString { get { return XD.Securi |
| | | 645 | | internal override XmlDictionaryString DefaultSymmetricSignatureAlgorithmDictionaryString { get { return XD.Secur |
| | | 646 | | internal override XmlDictionaryString DefaultAsymmetricSignatureAlgorithmDictionaryString { get { return XD.Secu |
| | | 647 | | |
| | | 648 | | public override string ToString() |
| | | 649 | | { |
| | | 650 | | return "Basic192"; |
| | | 651 | | } |
| | | 652 | | } |
| | | 653 | | |
| | | 654 | | public class Basic128SecurityAlgorithmSuite : SecurityAlgorithmSuite |
| | | 655 | | { |
| | | 656 | | public Basic128SecurityAlgorithmSuite() : base() { } |
| | | 657 | | |
| | | 658 | | public override string DefaultCanonicalizationAlgorithm { get { return DefaultCanonicalizationAlgorithmDictionar |
| | | 659 | | public override string DefaultDigestAlgorithm { get { return DefaultDigestAlgorithmDictionaryString.Value; } } |
| | | 660 | | public override string DefaultEncryptionAlgorithm { get { return DefaultEncryptionAlgorithmDictionaryString.Valu |
| | | 661 | | public override int DefaultEncryptionKeyDerivationLength { get { return 128; } } |
| | | 662 | | public override string DefaultSymmetricKeyWrapAlgorithm { get { return DefaultSymmetricKeyWrapAlgorithmDictionar |
| | | 663 | | public override string DefaultAsymmetricKeyWrapAlgorithm { get { return DefaultAsymmetricKeyWrapAlgorithmDiction |
| | | 664 | | public override string DefaultSymmetricSignatureAlgorithm { get { return DefaultSymmetricSignatureAlgorithmDicti |
| | | 665 | | public override string DefaultAsymmetricSignatureAlgorithm { get { return DefaultAsymmetricSignatureAlgorithmDic |
| | | 666 | | public override int DefaultSignatureKeyDerivationLength { get { return 128; } } |
| | | 667 | | public override int DefaultSymmetricKeyLength { get { return 128; } } |
| | | 668 | | public override bool IsSymmetricKeyLengthSupported(int length) { return length >= 128 && length <= 256; } |
| | | 669 | | public override bool IsAsymmetricKeyLengthSupported(int length) { return length >= 1024 && length <= 4096; } |
| | | 670 | | |
| | | 671 | | internal override XmlDictionaryString DefaultCanonicalizationAlgorithmDictionaryString { get { return XD.Securit |
| | | 672 | | internal override XmlDictionaryString DefaultDigestAlgorithmDictionaryString { get { return XD.SecurityAlgorithm |
| | | 673 | | internal override XmlDictionaryString DefaultEncryptionAlgorithmDictionaryString { get { return XD.SecurityAlgor |
| | | 674 | | internal override XmlDictionaryString DefaultSymmetricKeyWrapAlgorithmDictionaryString { get { return XD.Securit |
| | | 675 | | internal override XmlDictionaryString DefaultAsymmetricKeyWrapAlgorithmDictionaryString { get { return XD.Securi |
| | | 676 | | internal override XmlDictionaryString DefaultSymmetricSignatureAlgorithmDictionaryString { get { return XD.Secur |
| | | 677 | | internal override XmlDictionaryString DefaultAsymmetricSignatureAlgorithmDictionaryString { get { return XD.Secu |
| | | 678 | | |
| | | 679 | | public override string ToString() |
| | | 680 | | { |
| | | 681 | | return "Basic128"; |
| | | 682 | | } |
| | | 683 | | } |
| | | 684 | | |
| | | 685 | | public class TripleDesSecurityAlgorithmSuite : SecurityAlgorithmSuite |
| | | 686 | | { |
| | | 687 | | public TripleDesSecurityAlgorithmSuite() : base() { } |
| | | 688 | | |
| | | 689 | | public override string DefaultCanonicalizationAlgorithm { get { return DefaultCanonicalizationAlgorithmDictionar |
| | | 690 | | public override string DefaultDigestAlgorithm { get { return DefaultDigestAlgorithmDictionaryString.Value; } } |
| | | 691 | | public override string DefaultEncryptionAlgorithm { get { return DefaultEncryptionAlgorithmDictionaryString.Valu |
| | | 692 | | public override int DefaultEncryptionKeyDerivationLength { get { return 192; } } |
| | | 693 | | public override string DefaultSymmetricKeyWrapAlgorithm { get { return DefaultSymmetricKeyWrapAlgorithmDictionar |
| | | 694 | | public override string DefaultAsymmetricKeyWrapAlgorithm { get { return DefaultAsymmetricKeyWrapAlgorithmDiction |
| | | 695 | | |
| | | 696 | | public override string DefaultSymmetricSignatureAlgorithm { get { return DefaultSymmetricSignatureAlgorithmDicti |
| | | 697 | | public override string DefaultAsymmetricSignatureAlgorithm { get { return DefaultAsymmetricSignatureAlgorithmDic |
| | | 698 | | public override int DefaultSignatureKeyDerivationLength { get { return 192; } } |
| | | 699 | | public override int DefaultSymmetricKeyLength { get { return 192; } } |
| | | 700 | | public override bool IsSymmetricKeyLengthSupported(int length) { return length >= 192 && length <= 256; } |
| | | 701 | | public override bool IsAsymmetricKeyLengthSupported(int length) { return length >= 1024 && length <= 4096; } |
| | | 702 | | |
| | | 703 | | internal override XmlDictionaryString DefaultCanonicalizationAlgorithmDictionaryString { get { return XD.Securit |
| | | 704 | | internal override XmlDictionaryString DefaultDigestAlgorithmDictionaryString { get { return XD.SecurityAlgorithm |
| | | 705 | | internal override XmlDictionaryString DefaultEncryptionAlgorithmDictionaryString { get { return XD.SecurityAlgor |
| | | 706 | | internal override XmlDictionaryString DefaultSymmetricKeyWrapAlgorithmDictionaryString { get { return XD.Securit |
| | | 707 | | internal override XmlDictionaryString DefaultAsymmetricKeyWrapAlgorithmDictionaryString { get { return XD.Securi |
| | | 708 | | internal override XmlDictionaryString DefaultSymmetricSignatureAlgorithmDictionaryString { get { return XD.Secur |
| | | 709 | | internal override XmlDictionaryString DefaultAsymmetricSignatureAlgorithmDictionaryString { get { return XD.Secu |
| | | 710 | | |
| | | 711 | | public override string ToString() |
| | | 712 | | { |
| | | 713 | | return "TripleDes"; |
| | | 714 | | } |
| | | 715 | | } |
| | | 716 | | |
| | | 717 | | internal class Basic128Rsa15SecurityAlgorithmSuite : Basic128SecurityAlgorithmSuite |
| | | 718 | | { |
| | | 719 | | public Basic128Rsa15SecurityAlgorithmSuite() : base() { } |
| | | 720 | | |
| | | 721 | | internal override XmlDictionaryString DefaultAsymmetricKeyWrapAlgorithmDictionaryString { get { return XD.Securi |
| | | 722 | | |
| | | 723 | | public override string ToString() |
| | | 724 | | { |
| | | 725 | | return "Basic128Rsa15"; |
| | | 726 | | } |
| | | 727 | | } |
| | | 728 | | |
| | | 729 | | internal class Basic192Rsa15SecurityAlgorithmSuite : Basic192SecurityAlgorithmSuite |
| | | 730 | | { |
| | 2 | 731 | | public Basic192Rsa15SecurityAlgorithmSuite() : base() { } |
| | | 732 | | |
| | 0 | 733 | | internal override XmlDictionaryString DefaultAsymmetricKeyWrapAlgorithmDictionaryString { get { return XD.Securi |
| | | 734 | | |
| | | 735 | | public override string ToString() |
| | | 736 | | { |
| | 0 | 737 | | return "Basic192Rsa15"; |
| | | 738 | | } |
| | | 739 | | } |
| | | 740 | | |
| | | 741 | | internal class Basic256Rsa15SecurityAlgorithmSuite : Basic256SecurityAlgorithmSuite |
| | | 742 | | { |
| | | 743 | | public Basic256Rsa15SecurityAlgorithmSuite() : base() { } |
| | | 744 | | |
| | | 745 | | internal override XmlDictionaryString DefaultAsymmetricKeyWrapAlgorithmDictionaryString { get { return XD.Securi |
| | | 746 | | |
| | | 747 | | public override string ToString() |
| | | 748 | | { |
| | | 749 | | return "Basic256Rsa15"; |
| | | 750 | | } |
| | | 751 | | } |
| | | 752 | | |
| | | 753 | | internal class TripleDesRsa15SecurityAlgorithmSuite : TripleDesSecurityAlgorithmSuite |
| | | 754 | | { |
| | | 755 | | public TripleDesRsa15SecurityAlgorithmSuite() : base() { } |
| | | 756 | | |
| | | 757 | | internal override XmlDictionaryString DefaultAsymmetricKeyWrapAlgorithmDictionaryString { get { return XD.Securi |
| | | 758 | | |
| | | 759 | | public override string ToString() |
| | | 760 | | { |
| | | 761 | | return "TripleDesRsa15"; |
| | | 762 | | } |
| | | 763 | | } |
| | | 764 | | |
| | | 765 | | internal class Basic256Sha256SecurityAlgorithmSuite : Basic256SecurityAlgorithmSuite |
| | | 766 | | { |
| | | 767 | | public Basic256Sha256SecurityAlgorithmSuite() : base() { } |
| | | 768 | | |
| | | 769 | | internal override XmlDictionaryString DefaultDigestAlgorithmDictionaryString { get { return XD.SecurityAlgorithm |
| | | 770 | | internal override XmlDictionaryString DefaultSymmetricSignatureAlgorithmDictionaryString { get { return XD.Secur |
| | | 771 | | internal override XmlDictionaryString DefaultAsymmetricSignatureAlgorithmDictionaryString { get { return XD.Secu |
| | | 772 | | |
| | | 773 | | public override string ToString() |
| | | 774 | | { |
| | | 775 | | return "Basic256Sha256"; |
| | | 776 | | } |
| | | 777 | | } |
| | | 778 | | |
| | | 779 | | internal class Basic192Sha256SecurityAlgorithmSuite : Basic192SecurityAlgorithmSuite |
| | | 780 | | { |
| | | 781 | | public Basic192Sha256SecurityAlgorithmSuite() : base() { } |
| | | 782 | | |
| | | 783 | | internal override XmlDictionaryString DefaultDigestAlgorithmDictionaryString { get { return XD.SecurityAlgorithm |
| | | 784 | | internal override XmlDictionaryString DefaultSymmetricSignatureAlgorithmDictionaryString { get { return XD.Secur |
| | | 785 | | internal override XmlDictionaryString DefaultAsymmetricSignatureAlgorithmDictionaryString { get { return XD.Secu |
| | | 786 | | |
| | | 787 | | public override string ToString() |
| | | 788 | | { |
| | | 789 | | return "Basic192Sha256"; |
| | | 790 | | } |
| | | 791 | | } |
| | | 792 | | |
| | | 793 | | internal class Basic128Sha256SecurityAlgorithmSuite : Basic128SecurityAlgorithmSuite |
| | | 794 | | { |
| | | 795 | | public Basic128Sha256SecurityAlgorithmSuite() : base() { } |
| | | 796 | | |
| | | 797 | | internal override XmlDictionaryString DefaultDigestAlgorithmDictionaryString { get { return XD.SecurityAlgorithm |
| | | 798 | | internal override XmlDictionaryString DefaultSymmetricSignatureAlgorithmDictionaryString { get { return XD.Secur |
| | | 799 | | internal override XmlDictionaryString DefaultAsymmetricSignatureAlgorithmDictionaryString { get { return XD.Secu |
| | | 800 | | |
| | | 801 | | public override string ToString() |
| | | 802 | | { |
| | | 803 | | return "Basic128Sha256"; |
| | | 804 | | } |
| | | 805 | | } |
| | | 806 | | |
| | | 807 | | internal class TripleDesSha256SecurityAlgorithmSuite : TripleDesSecurityAlgorithmSuite |
| | | 808 | | { |
| | | 809 | | public TripleDesSha256SecurityAlgorithmSuite() : base() { } |
| | | 810 | | |
| | | 811 | | internal override XmlDictionaryString DefaultDigestAlgorithmDictionaryString { get { return XD.SecurityAlgorithm |
| | | 812 | | internal override XmlDictionaryString DefaultSymmetricSignatureAlgorithmDictionaryString { get { return XD.Secur |
| | | 813 | | internal override XmlDictionaryString DefaultAsymmetricSignatureAlgorithmDictionaryString { get { return XD.Secu |
| | | 814 | | |
| | | 815 | | public override string ToString() |
| | | 816 | | { |
| | | 817 | | return "TripleDesSha256"; |
| | | 818 | | } |
| | | 819 | | } |
| | | 820 | | |
| | | 821 | | internal class Basic256Sha256Rsa15SecurityAlgorithmSuite : Basic256Rsa15SecurityAlgorithmSuite |
| | | 822 | | { |
| | | 823 | | public Basic256Sha256Rsa15SecurityAlgorithmSuite() : base() { } |
| | | 824 | | |
| | | 825 | | internal override XmlDictionaryString DefaultDigestAlgorithmDictionaryString { get { return XD.SecurityAlgorithm |
| | | 826 | | internal override XmlDictionaryString DefaultSymmetricSignatureAlgorithmDictionaryString { get { return XD.Secur |
| | | 827 | | internal override XmlDictionaryString DefaultAsymmetricSignatureAlgorithmDictionaryString { get { return XD.Secu |
| | | 828 | | |
| | | 829 | | public override string ToString() |
| | | 830 | | { |
| | | 831 | | return "Basic256Sha256Rsa15"; |
| | | 832 | | } |
| | | 833 | | } |
| | | 834 | | |
| | | 835 | | internal class Basic192Sha256Rsa15SecurityAlgorithmSuite : Basic192Rsa15SecurityAlgorithmSuite |
| | | 836 | | { |
| | | 837 | | public Basic192Sha256Rsa15SecurityAlgorithmSuite() : base() { } |
| | | 838 | | |
| | | 839 | | internal override XmlDictionaryString DefaultDigestAlgorithmDictionaryString { get { return XD.SecurityAlgorithm |
| | | 840 | | internal override XmlDictionaryString DefaultSymmetricSignatureAlgorithmDictionaryString { get { return XD.Secur |
| | | 841 | | internal override XmlDictionaryString DefaultAsymmetricSignatureAlgorithmDictionaryString { get { return XD.Secu |
| | | 842 | | |
| | | 843 | | public override string ToString() |
| | | 844 | | { |
| | | 845 | | return "Basic192Sha256Rsa15"; |
| | | 846 | | } |
| | | 847 | | } |
| | | 848 | | |
| | | 849 | | internal class Basic128Sha256Rsa15SecurityAlgorithmSuite : Basic128Rsa15SecurityAlgorithmSuite |
| | | 850 | | { |
| | | 851 | | public Basic128Sha256Rsa15SecurityAlgorithmSuite() : base() { } |
| | | 852 | | |
| | | 853 | | internal override XmlDictionaryString DefaultDigestAlgorithmDictionaryString { get { return XD.SecurityAlgorithm |
| | | 854 | | internal override XmlDictionaryString DefaultSymmetricSignatureAlgorithmDictionaryString { get { return XD.Secur |
| | | 855 | | internal override XmlDictionaryString DefaultAsymmetricSignatureAlgorithmDictionaryString { get { return XD.Secu |
| | | 856 | | |
| | | 857 | | public override string ToString() |
| | | 858 | | { |
| | | 859 | | return "Basic128Sha256Rsa15"; |
| | | 860 | | } |
| | | 861 | | } |
| | | 862 | | |
| | | 863 | | internal class TripleDesSha256Rsa15SecurityAlgorithmSuite : TripleDesRsa15SecurityAlgorithmSuite |
| | | 864 | | { |
| | | 865 | | public TripleDesSha256Rsa15SecurityAlgorithmSuite() : base() { } |
| | | 866 | | |
| | | 867 | | internal override XmlDictionaryString DefaultDigestAlgorithmDictionaryString { get { return XD.SecurityAlgorithm |
| | | 868 | | internal override XmlDictionaryString DefaultSymmetricSignatureAlgorithmDictionaryString { get { return XD.Secur |
| | | 869 | | internal override XmlDictionaryString DefaultAsymmetricSignatureAlgorithmDictionaryString { get { return XD.Secu |
| | | 870 | | |
| | | 871 | | public override string ToString() |
| | | 872 | | { |
| | | 873 | | return "TripleDesSha256Rsa15"; |
| | | 874 | | } |
| | | 875 | | } |
| | | 876 | | } |