1 //------------------------------------------------------------ 2 // Copyright (c) Microsoft Corporation. All rights reserved. 3 //------------------------------------------------------------ 4 5 namespace Microsoft.InfoCards 6 { 7 using System.IdentityModel.Tokens; 8 using System.Security.Cryptography; 9 using System.Security.Cryptography.Xml; 10 11 // copied from IdentityModel\CryptoHelper.cs and they need to be kept in sync. After V1, we need to rethink how we can have 12 // a single place to ask this question. Perhaps even add it as an extensibility 13 14 internal static class InfoCardCryptoHelper 15 { 16 IsAsymmetricAlgorithm(string algorithm)17 internal static bool IsAsymmetricAlgorithm(string algorithm) 18 { 19 switch (algorithm) 20 { 21 case SecurityAlgorithms.DsaSha1Signature: 22 case SecurityAlgorithms.RsaSha1Signature: 23 case SecurityAlgorithms.RsaSha256Signature: 24 case SecurityAlgorithms.RsaOaepKeyWrap: 25 case SecurityAlgorithms.RsaV15KeyWrap: 26 return true; 27 default: 28 return false; 29 } 30 } 31 IsSymmetricAlgorithm(string algorithm)32 internal static bool IsSymmetricAlgorithm(string algorithm) 33 { 34 switch (algorithm) 35 { 36 case SecurityAlgorithms.HmacSha1Signature: 37 case SecurityAlgorithms.HmacSha256Signature: 38 case SecurityAlgorithms.Aes128Encryption: 39 case SecurityAlgorithms.Aes192Encryption: 40 case SecurityAlgorithms.Aes256Encryption: 41 case SecurityAlgorithms.TripleDesEncryption: 42 case SecurityAlgorithms.Aes128KeyWrap: 43 case SecurityAlgorithms.Aes192KeyWrap: 44 case SecurityAlgorithms.Aes256KeyWrap: 45 case SecurityAlgorithms.TripleDesKeyWrap: 46 case SecurityAlgorithms.Psha1KeyDerivation: 47 case SecurityAlgorithms.Psha1KeyDerivationDec2005: 48 return true; 49 default: 50 return false; 51 } 52 } 53 54 } 55 } 56