diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2015-11-10 19:42:21 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2015-11-10 19:42:21 +0700 |
commit | 218a170ece285fd49f82326c752a3d0fb31881dd (patch) | |
tree | 2a680d86ba2786e758f0fc9c845691f55ffe0553 /crypto/src/cms | |
parent | Fix IV check for 64-bit blockSize (diff) | |
download | BouncyCastle.NET-ed25519-218a170ece285fd49f82326c752a3d0fb31881dd.tar.xz |
Address various compiler warnings
Diffstat (limited to 'crypto/src/cms')
20 files changed, 36 insertions, 36 deletions
diff --git a/crypto/src/cms/CMSAuthenticatedData.cs b/crypto/src/cms/CMSAuthenticatedData.cs index 5e234da2b..33b4cc22c 100644 --- a/crypto/src/cms/CMSAuthenticatedData.cs +++ b/crypto/src/cms/CMSAuthenticatedData.cs @@ -83,7 +83,7 @@ namespace Org.BouncyCastle.Cms */ public string MacAlgOid { - get { return macAlg.ObjectID.Id; } + get { return macAlg.Algorithm.Id; } } /** diff --git a/crypto/src/cms/CMSAuthenticatedDataParser.cs b/crypto/src/cms/CMSAuthenticatedDataParser.cs index c99aac61c..7defafc07 100644 --- a/crypto/src/cms/CMSAuthenticatedDataParser.cs +++ b/crypto/src/cms/CMSAuthenticatedDataParser.cs @@ -111,7 +111,7 @@ namespace Org.BouncyCastle.Cms */ public string MacAlgOid { - get { return macAlg.ObjectID.Id; } + get { return macAlg.Algorithm.Id; } } diff --git a/crypto/src/cms/CMSAuthenticatedDataStreamGenerator.cs b/crypto/src/cms/CMSAuthenticatedDataStreamGenerator.cs index a135cdd11..4d18d10d4 100644 --- a/crypto/src/cms/CMSAuthenticatedDataStreamGenerator.cs +++ b/crypto/src/cms/CMSAuthenticatedDataStreamGenerator.cs @@ -165,7 +165,7 @@ namespace Org.BouncyCastle.Cms Stream octetOutputStream = CmsUtilities.CreateBerOctetOutputStream( eiGen.GetRawOutputStream(), 0, false, _bufferSize); - IMac mac = MacUtilities.GetMac(macAlgId.ObjectID); + IMac mac = MacUtilities.GetMac(macAlgId.Algorithm); // TODO Confirm no ParametersWithRandom needed mac.Init(cipherParameters); Stream mOut = new TeeOutputStream(octetOutputStream, new MacOutputStream(mac)); diff --git a/crypto/src/cms/CMSEnvelopedData.cs b/crypto/src/cms/CMSEnvelopedData.cs index 0731c307e..223d0ca73 100644 --- a/crypto/src/cms/CMSEnvelopedData.cs +++ b/crypto/src/cms/CMSEnvelopedData.cs @@ -73,7 +73,7 @@ namespace Org.BouncyCastle.Cms */ public string EncryptionAlgOid { - get { return encAlg.ObjectID.Id; } + get { return encAlg.Algorithm.Id; } } /** diff --git a/crypto/src/cms/CMSEnvelopedDataParser.cs b/crypto/src/cms/CMSEnvelopedDataParser.cs index 01a949d47..d5dfaf53d 100644 --- a/crypto/src/cms/CMSEnvelopedDataParser.cs +++ b/crypto/src/cms/CMSEnvelopedDataParser.cs @@ -101,7 +101,7 @@ namespace Org.BouncyCastle.Cms */ public string EncryptionAlgOid { - get { return _encAlg.ObjectID.Id; } + get { return _encAlg.Algorithm.Id; } } /** diff --git a/crypto/src/cms/CMSEnvelopedDataStreamGenerator.cs b/crypto/src/cms/CMSEnvelopedDataStreamGenerator.cs index bde8d9926..8e6d2729b 100644 --- a/crypto/src/cms/CMSEnvelopedDataStreamGenerator.cs +++ b/crypto/src/cms/CMSEnvelopedDataStreamGenerator.cs @@ -166,7 +166,7 @@ namespace Org.BouncyCastle.Cms Stream octetOutputStream = CmsUtilities.CreateBerOctetOutputStream( eiGen.GetRawOutputStream(), 0, false, _bufferSize); - IBufferedCipher cipher = CipherUtilities.GetCipher(encAlgID.ObjectID); + IBufferedCipher cipher = CipherUtilities.GetCipher(encAlgID.Algorithm); cipher.Init(true, new ParametersWithRandom(cipherParameters, rand)); CipherStream cOut = new CipherStream(octetOutputStream, null, cipher); diff --git a/crypto/src/cms/CMSEnvelopedHelper.cs b/crypto/src/cms/CMSEnvelopedHelper.cs index fe2b14cd9..77d2da47a 100644 --- a/crypto/src/cms/CMSEnvelopedHelper.cs +++ b/crypto/src/cms/CMSEnvelopedHelper.cs @@ -160,7 +160,7 @@ namespace Org.BouncyCastle.Cms public CmsReadable GetReadable(KeyParameter sKey) { - string macAlg = this.algorithm.ObjectID.Id; + string macAlg = this.algorithm.Algorithm.Id; // Asn1Object sParams = this.algorithm.Parameters.ToAsn1Object(); try @@ -190,11 +190,11 @@ namespace Org.BouncyCastle.Cms // if (asn1Params != null && !(asn1Params is Asn1Null)) // { // cipherParameters = ParameterUtilities.GetCipherParameters( -// macAlg.ObjectID, cipherParameters, asn1Params); +// macAlg.Algorithm, cipherParameters, asn1Params); // } // else // { -// string alg = macAlg.ObjectID.Id; +// string alg = macAlg.Algorithm.Id; // if (alg.Equals(CmsEnvelopedDataGenerator.DesEde3Cbc) // || alg.Equals(CmsEnvelopedDataGenerator.IdeaCbc) // || alg.Equals(CmsEnvelopedDataGenerator.Cast5Cbc)) @@ -258,7 +258,7 @@ namespace Org.BouncyCastle.Cms { try { - this.cipher = CipherUtilities.GetCipher(this.algorithm.ObjectID); + this.cipher = CipherUtilities.GetCipher(this.algorithm.Algorithm); Asn1Encodable asn1Enc = this.algorithm.Parameters; Asn1Object asn1Params = asn1Enc == null ? null : asn1Enc.ToAsn1Object(); @@ -268,11 +268,11 @@ namespace Org.BouncyCastle.Cms if (asn1Params != null && !(asn1Params is Asn1Null)) { cipherParameters = ParameterUtilities.GetCipherParameters( - this.algorithm.ObjectID, cipherParameters, asn1Params); + this.algorithm.Algorithm, cipherParameters, asn1Params); } else { - string alg = this.algorithm.ObjectID.Id; + string alg = this.algorithm.Algorithm.Id; if (alg.Equals(CmsEnvelopedDataGenerator.DesEde3Cbc) || alg.Equals(CmsEnvelopedDataGenerator.IdeaCbc) || alg.Equals(CmsEnvelopedDataGenerator.Cast5Cbc)) diff --git a/crypto/src/cms/CMSPBEKey.cs b/crypto/src/cms/CMSPBEKey.cs index cb1e54c36..e03307e57 100644 --- a/crypto/src/cms/CMSPBEKey.cs +++ b/crypto/src/cms/CMSPBEKey.cs @@ -50,9 +50,9 @@ namespace Org.BouncyCastle.Cms char[] password, AlgorithmIdentifier keyDerivationAlgorithm) { - if (!keyDerivationAlgorithm.ObjectID.Equals(PkcsObjectIdentifiers.IdPbkdf2)) + if (!keyDerivationAlgorithm.Algorithm.Equals(PkcsObjectIdentifiers.IdPbkdf2)) throw new ArgumentException("Unsupported key derivation algorithm: " - + keyDerivationAlgorithm.ObjectID); + + keyDerivationAlgorithm.Algorithm); Pbkdf2Params kdfParams = Pbkdf2Params.GetInstance( keyDerivationAlgorithm.Parameters.ToAsn1Object()); diff --git a/crypto/src/cms/CMSSignedData.cs b/crypto/src/cms/CMSSignedData.cs index 81c87a426..237c1528e 100644 --- a/crypto/src/cms/CMSSignedData.cs +++ b/crypto/src/cms/CMSSignedData.cs @@ -172,7 +172,7 @@ namespace Org.BouncyCastle.Cms } else { - byte[] hash = (byte[]) hashes[info.DigestAlgorithm.ObjectID.Id]; + byte[] hash = (byte[])hashes[info.DigestAlgorithm.Algorithm.Id]; signerInfos.Add(new SignerInformation(info, contentType, null, new BaseDigestCalculator(hash))); } diff --git a/crypto/src/cms/CMSSignedDataParser.cs b/crypto/src/cms/CMSSignedDataParser.cs index e5e6edc58..fb51ab119 100644 --- a/crypto/src/cms/CMSSignedDataParser.cs +++ b/crypto/src/cms/CMSSignedDataParser.cs @@ -122,7 +122,7 @@ namespace Org.BouncyCastle.Cms try { - string digestOid = id.ObjectID.Id; + string digestOid = id.Algorithm.Id; string digestName = Helper.GetDigestAlgName(digestOid); if (!this._digests.Contains(digestName)) @@ -216,7 +216,7 @@ namespace Org.BouncyCastle.Cms { SignerInfo info = SignerInfo.GetInstance(o.ToAsn1Object()); string digestName = Helper.GetDigestAlgName( - info.DigestAlgorithm.ObjectID.Id); + info.DigestAlgorithm.Algorithm.Id); byte[] hash = (byte[]) hashes[digestName]; diff --git a/crypto/src/cms/CMSSignedDataStreamGenerator.cs b/crypto/src/cms/CMSSignedDataStreamGenerator.cs index 1477d884f..d0ab7428a 100644 --- a/crypto/src/cms/CMSSignedDataStreamGenerator.cs +++ b/crypto/src/cms/CMSSignedDataStreamGenerator.cs @@ -459,7 +459,7 @@ namespace Org.BouncyCastle.Cms // NB: Would need to call FixAlgID on the DigestAlgorithmID // For precalculated signers, just need to register the algorithm, not configure a digest - RegisterDigestOid(si.DigestAlgorithmID.ObjectID.Id); + RegisterDigestOid(si.DigestAlgorithmID.Algorithm.Id); } /** diff --git a/crypto/src/cms/CMSSignedHelper.cs b/crypto/src/cms/CMSSignedHelper.cs index 23657ef86..5b6c93b6a 100644 --- a/crypto/src/cms/CMSSignedHelper.cs +++ b/crypto/src/cms/CMSSignedHelper.cs @@ -348,7 +348,7 @@ namespace Org.BouncyCastle.Cms AlgorithmIdentifier algId) { if (algId.Parameters == null) - return new AlgorithmIdentifier(algId.ObjectID, DerNull.Instance); + return new AlgorithmIdentifier(algId.Algorithm, DerNull.Instance); return algId; } diff --git a/crypto/src/cms/KEKRecipientInfoGenerator.cs b/crypto/src/cms/KEKRecipientInfoGenerator.cs index a9bedade6..c66f27547 100644 --- a/crypto/src/cms/KEKRecipientInfoGenerator.cs +++ b/crypto/src/cms/KEKRecipientInfoGenerator.cs @@ -52,7 +52,7 @@ namespace Org.BouncyCastle.Cms { byte[] keyBytes = contentEncryptionKey.GetKey(); - IWrapper keyWrapper = Helper.CreateWrapper(keyEncryptionAlgorithm.ObjectID.Id); + IWrapper keyWrapper = Helper.CreateWrapper(keyEncryptionAlgorithm.Algorithm.Id); keyWrapper.Init(true, new ParametersWithRandom(keyEncryptionKey, random)); Asn1OctetString encryptedKey = new DerOctetString( keyWrapper.Wrap(keyBytes, 0, keyBytes.Length)); diff --git a/crypto/src/cms/KEKRecipientInformation.cs b/crypto/src/cms/KEKRecipientInformation.cs index f960197d6..871dc76d4 100644 --- a/crypto/src/cms/KEKRecipientInformation.cs +++ b/crypto/src/cms/KEKRecipientInformation.cs @@ -40,7 +40,7 @@ namespace Org.BouncyCastle.Cms try { byte[] encryptedKey = info.EncryptedKey.GetOctets(); - IWrapper keyWrapper = WrapperUtilities.GetWrapper(keyEncAlg.ObjectID.Id); + IWrapper keyWrapper = WrapperUtilities.GetWrapper(keyEncAlg.Algorithm.Id); keyWrapper.Init(false, key); diff --git a/crypto/src/cms/KeyAgreeRecipientInfoGenerator.cs b/crypto/src/cms/KeyAgreeRecipientInfoGenerator.cs index 4fafb7c6e..6bd2cea91 100644 --- a/crypto/src/cms/KeyAgreeRecipientInfoGenerator.cs +++ b/crypto/src/cms/KeyAgreeRecipientInfoGenerator.cs @@ -164,7 +164,7 @@ namespace Org.BouncyCastle.Cms { SubjectPublicKeyInfo spki = SubjectPublicKeyInfoFactory.CreateSubjectPublicKeyInfo(publicKey); return new OriginatorPublicKey( - new AlgorithmIdentifier(spki.AlgorithmID.ObjectID, DerNull.Instance), + new AlgorithmIdentifier(spki.AlgorithmID.Algorithm, DerNull.Instance), spki.PublicKeyData.GetBytes()); } } diff --git a/crypto/src/cms/KeyAgreeRecipientInformation.cs b/crypto/src/cms/KeyAgreeRecipientInformation.cs index 8e006e545..73e57a76a 100644 --- a/crypto/src/cms/KeyAgreeRecipientInformation.cs +++ b/crypto/src/cms/KeyAgreeRecipientInformation.cs @@ -130,7 +130,7 @@ namespace Org.BouncyCastle.Cms AsymmetricKeyParameter senderPublicKey, AsymmetricKeyParameter receiverPrivateKey) { - DerObjectIdentifier agreeAlgID = keyEncAlg.ObjectID; + DerObjectIdentifier agreeAlgID = keyEncAlg.Algorithm; ICipherParameters senderPublicParams = senderPublicKey; ICipherParameters receiverPrivateParams = receiverPrivateKey; diff --git a/crypto/src/cms/KeyTransRecipientInfoGenerator.cs b/crypto/src/cms/KeyTransRecipientInfoGenerator.cs index 0992e6da6..a1d8fbfa8 100644 --- a/crypto/src/cms/KeyTransRecipientInfoGenerator.cs +++ b/crypto/src/cms/KeyTransRecipientInfoGenerator.cs @@ -64,7 +64,7 @@ namespace Org.BouncyCastle.Cms byte[] keyBytes = contentEncryptionKey.GetKey(); AlgorithmIdentifier keyEncryptionAlgorithm = info.AlgorithmID; - IWrapper keyWrapper = Helper.CreateWrapper(keyEncryptionAlgorithm.ObjectID.Id); + IWrapper keyWrapper = Helper.CreateWrapper(keyEncryptionAlgorithm.Algorithm.Id); keyWrapper.Init(true, new ParametersWithRandom(recipientPublicKey, random)); byte[] encryptedKeyBytes = keyWrapper.Wrap(keyBytes, 0, keyBytes.Length); diff --git a/crypto/src/cms/KeyTransRecipientInformation.cs b/crypto/src/cms/KeyTransRecipientInformation.cs index 24121cb2c..3b1ea7b5e 100644 --- a/crypto/src/cms/KeyTransRecipientInformation.cs +++ b/crypto/src/cms/KeyTransRecipientInformation.cs @@ -68,7 +68,7 @@ namespace Org.BouncyCastle.Cms internal KeyParameter UnwrapKey(ICipherParameters key) { byte[] encryptedKey = info.EncryptedKey.GetOctets(); - string keyExchangeAlgorithm = GetExchangeEncryptionAlgorithmName(keyEncAlg.ObjectID); + string keyExchangeAlgorithm = GetExchangeEncryptionAlgorithmName(keyEncAlg.Algorithm); try { diff --git a/crypto/src/cms/RecipientInformation.cs b/crypto/src/cms/RecipientInformation.cs index 8b0316be4..272b841f2 100644 --- a/crypto/src/cms/RecipientInformation.cs +++ b/crypto/src/cms/RecipientInformation.cs @@ -33,8 +33,8 @@ namespace Org.BouncyCastle.Cms internal string GetContentAlgorithmName() { AlgorithmIdentifier algorithm = secureReadable.Algorithm; -// return CmsEnvelopedHelper.Instance.GetSymmetricCipherName(algorithm.ObjectID.Id); - return algorithm.ObjectID.Id; +// return CmsEnvelopedHelper.Instance.GetSymmetricCipherName(algorithm.Algorithm.Id); + return algorithm.Algorithm.Id; } public RecipientID RecipientID @@ -54,7 +54,7 @@ namespace Org.BouncyCastle.Cms */ public string KeyEncryptionAlgOid { - get { return keyEncAlg.ObjectID.Id; } + get { return keyEncAlg.Algorithm.Id; } } /** diff --git a/crypto/src/cms/SignerInformation.cs b/crypto/src/cms/SignerInformation.cs index 581286a3f..dad128263 100644 --- a/crypto/src/cms/SignerInformation.cs +++ b/crypto/src/cms/SignerInformation.cs @@ -117,7 +117,7 @@ namespace Org.BouncyCastle.Cms */ public string DigestAlgOid { - get { return digestAlgorithm.ObjectID.Id; } + get { return digestAlgorithm.Algorithm.Id; } } /** @@ -156,7 +156,7 @@ namespace Org.BouncyCastle.Cms */ public string EncryptionAlgOid { - get { return encryptionAlgorithm.ObjectID.Id; } + get { return encryptionAlgorithm.Algorithm.Id; } } /** @@ -272,7 +272,7 @@ namespace Org.BouncyCastle.Cms */ SignerInfo si = SignerInfo.GetInstance(asn1Obj.ToAsn1Object()); - string digestName = CmsSignedHelper.Instance.GetDigestAlgName(si.DigestAlgorithm.ObjectID.Id); + string digestName = CmsSignedHelper.Instance.GetDigestAlgName(si.DigestAlgorithm.Algorithm.Id); counterSignatures.Add(new SignerInformation(si, null, null, new CounterSignatureDigestCalculator(digestName, GetSignature()))); } @@ -298,7 +298,7 @@ namespace Org.BouncyCastle.Cms string digestName = Helper.GetDigestAlgName(this.DigestAlgOid); IDigest digest = Helper.GetDigestInstance(digestName); - DerObjectIdentifier sigAlgOid = this.encryptionAlgorithm.ObjectID; + DerObjectIdentifier sigAlgOid = this.encryptionAlgorithm.Algorithm; Asn1Encodable sigParams = this.encryptionAlgorithm.Parameters; ISigner sig; @@ -318,12 +318,12 @@ namespace Org.BouncyCastle.Cms Asn1.Pkcs.RsassaPssParameters pss = Asn1.Pkcs.RsassaPssParameters.GetInstance( sigParams.ToAsn1Object()); - if (!pss.HashAlgorithm.ObjectID.Equals(this.digestAlgorithm.ObjectID)) + if (!pss.HashAlgorithm.Algorithm.Equals(this.digestAlgorithm.Algorithm)) throw new CmsException("RSASSA-PSS signature parameters specified incorrect hash algorithm"); - if (!pss.MaskGenAlgorithm.ObjectID.Equals(Asn1.Pkcs.PkcsObjectIdentifiers.IdMgf1)) + if (!pss.MaskGenAlgorithm.Algorithm.Equals(Asn1.Pkcs.PkcsObjectIdentifiers.IdMgf1)) throw new CmsException("RSASSA-PSS signature parameters specified unknown MGF"); - IDigest pssDigest = DigestUtilities.GetDigest(pss.HashAlgorithm.ObjectID); + IDigest pssDigest = DigestUtilities.GetDigest(pss.HashAlgorithm.Algorithm); int saltLength = pss.SaltLength.Value.IntValue; byte trailerField = (byte) pss.TrailerField.Value.IntValue; @@ -532,7 +532,7 @@ namespace Org.BouncyCastle.Cms DigestInfo digInfo = DerDecode(decrypt); - if (!digInfo.AlgorithmID.ObjectID.Equals(digestAlgorithm.ObjectID)) + if (!digInfo.AlgorithmID.Algorithm.Equals(digestAlgorithm.Algorithm)) { return false; } |