summary refs log tree commit diff
path: root/crypto/src/cms
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2015-11-12 22:57:06 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2015-11-12 22:57:06 +0700
commit809e86bbf8ed478e7aa7b9de8a3bfc3014289bd5 (patch)
tree9287ae725992c5972bed155ec4f4773fdace7b22 /crypto/src/cms
parentRefactoring of "unused bits" changes (diff)
downloadBouncyCastle.NET-ed25519-809e86bbf8ed478e7aa7b9de8a3bfc3014289bd5.tar.xz
Review of culture-independent String comparison methods
Diffstat (limited to 'crypto/src/cms')
-rw-r--r--crypto/src/cms/KEKRecipientInfoGenerator.cs11
-rw-r--r--crypto/src/cms/PasswordRecipientInfoGenerator.cs3
2 files changed, 8 insertions, 6 deletions
diff --git a/crypto/src/cms/KEKRecipientInfoGenerator.cs b/crypto/src/cms/KEKRecipientInfoGenerator.cs
index c66f27547..6f34fec43 100644
--- a/crypto/src/cms/KEKRecipientInfoGenerator.cs
+++ b/crypto/src/cms/KEKRecipientInfoGenerator.cs
@@ -10,6 +10,7 @@ using Org.BouncyCastle.Asn1.X509;
 using Org.BouncyCastle.Crypto;
 using Org.BouncyCastle.Crypto.Parameters;
 using Org.BouncyCastle.Security;
+using Org.BouncyCastle.Utilities;
 
 namespace Org.BouncyCastle.Cms
 {
@@ -63,19 +64,19 @@ namespace Org.BouncyCastle.Cms
 		private static AlgorithmIdentifier DetermineKeyEncAlg(
 			string algorithm, KeyParameter key)
 		{
-			if (algorithm.StartsWith("DES"))
+			if (Platform.StartsWith(algorithm, "DES"))
 			{
 				return new AlgorithmIdentifier(
 					PkcsObjectIdentifiers.IdAlgCms3DesWrap,
 					DerNull.Instance);
 			}
-			else if (algorithm.StartsWith("RC2"))
+            else if (Platform.StartsWith(algorithm, "RC2"))
 			{
 				return new AlgorithmIdentifier(
 					PkcsObjectIdentifiers.IdAlgCmsRC2Wrap,
 					new DerInteger(58));
 			}
-			else if (algorithm.StartsWith("AES"))
+			else if (Platform.StartsWith(algorithm, "AES"))
 			{
 				int length = key.GetKey().Length * 8;
 				DerObjectIdentifier wrapOid;
@@ -99,12 +100,12 @@ namespace Org.BouncyCastle.Cms
 
 				return new AlgorithmIdentifier(wrapOid);  // parameters absent
 			}
-			else if (algorithm.StartsWith("SEED"))
+			else if (Platform.StartsWith(algorithm, "SEED"))
 			{
 				// parameters absent
 				return new AlgorithmIdentifier(KisaObjectIdentifiers.IdNpkiAppCmsSeedWrap);
 			}
-			else if (algorithm.StartsWith("CAMELLIA"))
+			else if (Platform.StartsWith(algorithm, "CAMELLIA"))
 			{
 				int length = key.GetKey().Length * 8;
 				DerObjectIdentifier wrapOid;
diff --git a/crypto/src/cms/PasswordRecipientInfoGenerator.cs b/crypto/src/cms/PasswordRecipientInfoGenerator.cs
index 0a0b27b53..9916edfc4 100644
--- a/crypto/src/cms/PasswordRecipientInfoGenerator.cs
+++ b/crypto/src/cms/PasswordRecipientInfoGenerator.cs
@@ -7,6 +7,7 @@ using Org.BouncyCastle.Asn1.X509;
 using Org.BouncyCastle.Crypto;
 using Org.BouncyCastle.Crypto.Parameters;
 using Org.BouncyCastle.Security;
+using Org.BouncyCastle.Utilities;
 
 namespace Org.BouncyCastle.Cms
 {
@@ -46,7 +47,7 @@ namespace Org.BouncyCastle.Cms
 			IWrapper keyWrapper = Helper.CreateWrapper(rfc3211WrapperName);
 
 			// Note: In Java build, the IV is automatically generated in JCE layer
-			int ivLength = rfc3211WrapperName.StartsWith("DESEDE") ? 8 : 16;
+			int ivLength = Platform.StartsWith(rfc3211WrapperName, "DESEDE") ? 8 : 16;
 			byte[] iv = new byte[ivLength];
 			random.NextBytes(iv);