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);
|