diff options
Diffstat (limited to 'crypto/src')
59 files changed, 64 insertions, 136 deletions
diff --git a/crypto/src/asn1/Asn1Exception.cs b/crypto/src/asn1/Asn1Exception.cs index 1dfe1732c..9e4afb49f 100644 --- a/crypto/src/asn1/Asn1Exception.cs +++ b/crypto/src/asn1/Asn1Exception.cs @@ -3,7 +3,7 @@ using System.IO; namespace Org.BouncyCastle.Asn1 { -#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE) +#if !PORTABLE [Serializable] #endif public class Asn1Exception diff --git a/crypto/src/asn1/Asn1ParsingException.cs b/crypto/src/asn1/Asn1ParsingException.cs index 84cdb780d..294e4c2c9 100644 --- a/crypto/src/asn1/Asn1ParsingException.cs +++ b/crypto/src/asn1/Asn1ParsingException.cs @@ -2,7 +2,7 @@ using System; namespace Org.BouncyCastle.Asn1 { -#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE) +#if !PORTABLE [Serializable] #endif public class Asn1ParsingException diff --git a/crypto/src/asn1/Asn1TaggedObject.cs b/crypto/src/asn1/Asn1TaggedObject.cs index 8882cdcb7..f2eca9ad8 100644 --- a/crypto/src/asn1/Asn1TaggedObject.cs +++ b/crypto/src/asn1/Asn1TaggedObject.cs @@ -379,8 +379,7 @@ namespace Org.BouncyCastle.Asn1 internal static Asn1Object CreatePrimitive(int tagClass, int tagNo, byte[] contentsOctets) { // Note: !CONSTRUCTED => IMPLICIT - return new DLTaggedObject(ParsedImplicit, tagClass, tagNo, - new DerOctetString(contentsOctets)); + return new DLTaggedObject(ParsedImplicit, tagClass, tagNo, new DerOctetString(contentsOctets)); } private static Asn1TaggedObject CheckedCast(Asn1Object asn1Object) diff --git a/crypto/src/asn1/DerGeneralizedTime.cs b/crypto/src/asn1/DerGeneralizedTime.cs index ed2cb5e62..1efa792df 100644 --- a/crypto/src/asn1/DerGeneralizedTime.cs +++ b/crypto/src/asn1/DerGeneralizedTime.cs @@ -181,7 +181,7 @@ namespace Org.BouncyCastle.Asn1 char sign = '+'; DateTime time = ToDateTime(); -#if SILVERLIGHT || PORTABLE +#if PORTABLE long offset = time.Ticks - time.ToUniversalTime().Ticks; if (offset < 0) { diff --git a/crypto/src/asn1/x509/NameConstraints.cs b/crypto/src/asn1/x509/NameConstraints.cs index b8cc7c0ab..40178c126 100644 --- a/crypto/src/asn1/x509/NameConstraints.cs +++ b/crypto/src/asn1/x509/NameConstraints.cs @@ -43,7 +43,7 @@ namespace Org.BouncyCastle.Asn1.X509 } } -#if !(SILVERLIGHT || PORTABLE) +#if !PORTABLE public NameConstraints( ArrayList permitted, ArrayList excluded) diff --git a/crypto/src/asn1/x509/PolicyMappings.cs b/crypto/src/asn1/x509/PolicyMappings.cs index 928ad134d..8c9f97814 100644 --- a/crypto/src/asn1/x509/PolicyMappings.cs +++ b/crypto/src/asn1/x509/PolicyMappings.cs @@ -29,7 +29,7 @@ namespace Org.BouncyCastle.Asn1.X509 this.seq = seq; } -#if !(SILVERLIGHT || PORTABLE) +#if !PORTABLE public PolicyMappings( Hashtable mappings) : this((IDictionary)mappings) diff --git a/crypto/src/asn1/x509/X509Name.cs b/crypto/src/asn1/x509/X509Name.cs index bd8f9fb3e..33c395712 100644 --- a/crypto/src/asn1/x509/X509Name.cs +++ b/crypto/src/asn1/x509/X509Name.cs @@ -3,7 +3,7 @@ using System.Collections; using System.IO; using System.Text; -#if SILVERLIGHT || PORTABLE +#if PORTABLE using System.Collections.Generic; #endif @@ -208,7 +208,7 @@ namespace Org.BouncyCastle.Asn1.X509 private static readonly bool[] defaultReverse = { false }; -#if SILVERLIGHT || PORTABLE +#if PORTABLE /** * default look up table translating OID values into their common symbols following * the convention in RFC 2253 with a few extras @@ -1024,7 +1024,7 @@ namespace Org.BouncyCastle.Asn1.X509 bool reverse, IDictionary oidSymbols) { -#if SILVERLIGHT || PORTABLE +#if PORTABLE List<object> components = new List<object>(); #else ArrayList components = new ArrayList(); diff --git a/crypto/src/bcpg/BcpgInputStream.cs b/crypto/src/bcpg/BcpgInputStream.cs index 87c3f3812..895b03260 100644 --- a/crypto/src/bcpg/BcpgInputStream.cs +++ b/crypto/src/bcpg/BcpgInputStream.cs @@ -184,7 +184,7 @@ namespace Org.BouncyCastle.Bcpg else { PartialInputStream pis = new PartialInputStream(this, partial, bodyLen); -#if NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE +#if PORTABLE Stream buf = pis; #else Stream buf = new BufferedStream(pis); diff --git a/crypto/src/cms/CMSAttributeTableGenerationException.cs b/crypto/src/cms/CMSAttributeTableGenerationException.cs index 87dad9929..692be2804 100644 --- a/crypto/src/cms/CMSAttributeTableGenerationException.cs +++ b/crypto/src/cms/CMSAttributeTableGenerationException.cs @@ -2,7 +2,7 @@ using System; namespace Org.BouncyCastle.Cms { -#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE) +#if !PORTABLE [Serializable] #endif public class CmsAttributeTableGenerationException diff --git a/crypto/src/cms/CMSException.cs b/crypto/src/cms/CMSException.cs index 29fe0a6c0..83de3f00e 100644 --- a/crypto/src/cms/CMSException.cs +++ b/crypto/src/cms/CMSException.cs @@ -2,7 +2,7 @@ using System; namespace Org.BouncyCastle.Cms { -#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE) +#if !PORTABLE [Serializable] #endif public class CmsException diff --git a/crypto/src/cms/CMSSignedDataGenerator.cs b/crypto/src/cms/CMSSignedDataGenerator.cs index f2d54baa6..20dc59f36 100644 --- a/crypto/src/cms/CMSSignedDataGenerator.cs +++ b/crypto/src/cms/CMSSignedDataGenerator.cs @@ -137,7 +137,7 @@ namespace Org.BouncyCastle.Cms IStreamCalculator calculator = sigCalc.CreateCalculator(); -#if NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE +#if PORTABLE Stream sigStr = calculator.Stream; #else Stream sigStr = new BufferedStream(calculator.Stream); diff --git a/crypto/src/cms/CMSStreamException.cs b/crypto/src/cms/CMSStreamException.cs index 68a8be017..c3b0f9621 100644 --- a/crypto/src/cms/CMSStreamException.cs +++ b/crypto/src/cms/CMSStreamException.cs @@ -3,7 +3,7 @@ using System.IO; namespace Org.BouncyCastle.Cms { -#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE) +#if !PORTABLE [Serializable] #endif public class CmsStreamException diff --git a/crypto/src/cms/CMSTypedStream.cs b/crypto/src/cms/CMSTypedStream.cs index 681583765..e99d904b5 100644 --- a/crypto/src/cms/CMSTypedStream.cs +++ b/crypto/src/cms/CMSTypedStream.cs @@ -33,7 +33,7 @@ namespace Org.BouncyCastle.Cms int bufSize) { _oid = oid; -#if NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE +#if PORTABLE _in = new FullReaderStream(inStream); #else _in = new FullReaderStream(new BufferedStream(inStream, bufSize)); diff --git a/crypto/src/cms/DefaultSignedAttributeTableGenerator.cs b/crypto/src/cms/DefaultSignedAttributeTableGenerator.cs index 925a98a3c..fad80b52b 100644 --- a/crypto/src/cms/DefaultSignedAttributeTableGenerator.cs +++ b/crypto/src/cms/DefaultSignedAttributeTableGenerator.cs @@ -41,7 +41,7 @@ namespace Org.BouncyCastle.Cms } } -#if SILVERLIGHT || PORTABLE +#if PORTABLE /** * Create a standard attribute table from the passed in parameters - this will * normally include contentType, signingTime, and messageDigest. If the constructor diff --git a/crypto/src/crypto/CryptoException.cs b/crypto/src/crypto/CryptoException.cs index 73d450be1..c5ee938c7 100644 --- a/crypto/src/crypto/CryptoException.cs +++ b/crypto/src/crypto/CryptoException.cs @@ -2,7 +2,7 @@ using System; namespace Org.BouncyCastle.Crypto { -#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE) +#if !PORTABLE [Serializable] #endif public class CryptoException diff --git a/crypto/src/crypto/DataLengthException.cs b/crypto/src/crypto/DataLengthException.cs index 447ff2a17..5dde879d1 100644 --- a/crypto/src/crypto/DataLengthException.cs +++ b/crypto/src/crypto/DataLengthException.cs @@ -8,7 +8,7 @@ namespace Org.BouncyCastle.Crypto * insufficient input. In general this exception will Get thrown rather * than an ArrayOutOfBounds exception. */ -#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE) +#if !PORTABLE [Serializable] #endif public class DataLengthException diff --git a/crypto/src/crypto/InvalidCipherTextException.cs b/crypto/src/crypto/InvalidCipherTextException.cs index 0fe540d96..760ef3206 100644 --- a/crypto/src/crypto/InvalidCipherTextException.cs +++ b/crypto/src/crypto/InvalidCipherTextException.cs @@ -6,7 +6,7 @@ namespace Org.BouncyCastle.Crypto * this exception is thrown whenever we find something we don't expect in a * message. */ -#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE) +#if !PORTABLE [Serializable] #endif public class InvalidCipherTextException diff --git a/crypto/src/crypto/MaxBytesExceededException.cs b/crypto/src/crypto/MaxBytesExceededException.cs index 8992c45da..032901c1d 100644 --- a/crypto/src/crypto/MaxBytesExceededException.cs +++ b/crypto/src/crypto/MaxBytesExceededException.cs @@ -6,7 +6,7 @@ namespace Org.BouncyCastle.Crypto /// This exception is thrown whenever a cipher requires a change of key, iv /// or similar after x amount of bytes enciphered /// </summary> -#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE) +#if !PORTABLE [Serializable] #endif public class MaxBytesExceededException diff --git a/crypto/src/crypto/OutputLengthException.cs b/crypto/src/crypto/OutputLengthException.cs index 437589f47..5f091f2ec 100644 --- a/crypto/src/crypto/OutputLengthException.cs +++ b/crypto/src/crypto/OutputLengthException.cs @@ -2,7 +2,7 @@ namespace Org.BouncyCastle.Crypto { -#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE) +#if !PORTABLE [Serializable] #endif public class OutputLengthException diff --git a/crypto/src/crypto/prng/CryptoApiEntropySourceProvider.cs b/crypto/src/crypto/prng/CryptoApiEntropySourceProvider.cs index 459d3a740..a0925f1ba 100644 --- a/crypto/src/crypto/prng/CryptoApiEntropySourceProvider.cs +++ b/crypto/src/crypto/prng/CryptoApiEntropySourceProvider.cs @@ -1,4 +1,4 @@ -#if !(NETCF_1_0 || PORTABLE) +#if !PORTABLE using System; using System.Security.Cryptography; diff --git a/crypto/src/crypto/prng/CryptoApiRandomGenerator.cs b/crypto/src/crypto/prng/CryptoApiRandomGenerator.cs index 0b6592025..d324a935f 100644 --- a/crypto/src/crypto/prng/CryptoApiRandomGenerator.cs +++ b/crypto/src/crypto/prng/CryptoApiRandomGenerator.cs @@ -1,4 +1,4 @@ -#if !(NETCF_1_0 || PORTABLE) +#if !PORTABLE using System; using System.Security.Cryptography; diff --git a/crypto/src/crypto/prng/ThreadedSeedGenerator.cs b/crypto/src/crypto/prng/ThreadedSeedGenerator.cs index f12b832ee..bc30458f5 100644 --- a/crypto/src/crypto/prng/ThreadedSeedGenerator.cs +++ b/crypto/src/crypto/prng/ThreadedSeedGenerator.cs @@ -19,14 +19,8 @@ namespace Org.BouncyCastle.Crypto.Prng { private class SeedGenerator { -#if NETCF_1_0 - // No volatile keyword, but all fields implicitly volatile anyway - private int counter = 0; - private bool stop = false; -#else private volatile int counter = 0; private volatile bool stop = false; -#endif private void Run(object ignored) { @@ -40,7 +34,7 @@ namespace Org.BouncyCastle.Crypto.Prng int numBytes, bool fast) { -#if SILVERLIGHT || PORTABLE +#if PORTABLE return DoGenerateSeed(numBytes, fast); #else ThreadPriority originalPriority = Thread.CurrentThread.Priority; diff --git a/crypto/src/math/BigInteger.cs b/crypto/src/math/BigInteger.cs index 3badb6d2c..96d74870d 100644 --- a/crypto/src/math/BigInteger.cs +++ b/crypto/src/math/BigInteger.cs @@ -9,7 +9,7 @@ using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Math { -#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE) +#if !PORTABLE [Serializable] #endif public class BigInteger diff --git a/crypto/src/ocsp/OCSPException.cs b/crypto/src/ocsp/OCSPException.cs index d7b14ddc7..5ec11fbf7 100644 --- a/crypto/src/ocsp/OCSPException.cs +++ b/crypto/src/ocsp/OCSPException.cs @@ -2,7 +2,7 @@ using System; namespace Org.BouncyCastle.Ocsp { -#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE) +#if !PORTABLE [Serializable] #endif public class OcspException diff --git a/crypto/src/openpgp/PgpDataValidationException.cs b/crypto/src/openpgp/PgpDataValidationException.cs index d06833c16..cec5c9b68 100644 --- a/crypto/src/openpgp/PgpDataValidationException.cs +++ b/crypto/src/openpgp/PgpDataValidationException.cs @@ -5,7 +5,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp /// <remarks> /// Thrown if the IV at the start of a data stream indicates the wrong key is being used. /// </remarks> -#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE) +#if !PORTABLE [Serializable] #endif public class PgpDataValidationException diff --git a/crypto/src/openpgp/PgpException.cs b/crypto/src/openpgp/PgpException.cs index e2cce982a..dc0f3482b 100644 --- a/crypto/src/openpgp/PgpException.cs +++ b/crypto/src/openpgp/PgpException.cs @@ -3,7 +3,7 @@ using System; namespace Org.BouncyCastle.Bcpg.OpenPgp { /// <remarks>Generic exception class for PGP encoding/decoding problems.</remarks> -#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE) +#if !PORTABLE [Serializable] #endif public class PgpException diff --git a/crypto/src/openpgp/PgpKeyValidationException.cs b/crypto/src/openpgp/PgpKeyValidationException.cs index 383ae57a2..df6abefe8 100644 --- a/crypto/src/openpgp/PgpKeyValidationException.cs +++ b/crypto/src/openpgp/PgpKeyValidationException.cs @@ -5,7 +5,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp /// <remarks> /// Thrown if the key checksum is invalid. /// </remarks> -#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE) +#if !PORTABLE [Serializable] #endif public class PgpKeyValidationException diff --git a/crypto/src/openssl/EncryptionException.cs b/crypto/src/openssl/EncryptionException.cs index 043e90234..c17eb99c4 100644 --- a/crypto/src/openssl/EncryptionException.cs +++ b/crypto/src/openssl/EncryptionException.cs @@ -3,7 +3,7 @@ using System.IO; namespace Org.BouncyCastle.Security { -#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE) +#if !PORTABLE [Serializable] #endif public class EncryptionException diff --git a/crypto/src/openssl/PEMException.cs b/crypto/src/openssl/PEMException.cs index 6b3e51065..3d51d799e 100644 --- a/crypto/src/openssl/PEMException.cs +++ b/crypto/src/openssl/PEMException.cs @@ -3,7 +3,7 @@ using System.IO; namespace Org.BouncyCastle.OpenSsl { -#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE) +#if !PORTABLE [Serializable] #endif public class PemException diff --git a/crypto/src/openssl/PasswordException.cs b/crypto/src/openssl/PasswordException.cs index 38e679bb1..c920cc7a8 100644 --- a/crypto/src/openssl/PasswordException.cs +++ b/crypto/src/openssl/PasswordException.cs @@ -3,7 +3,7 @@ using System.IO; namespace Org.BouncyCastle.Security { -#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE) +#if !PORTABLE [Serializable] #endif public class PasswordException diff --git a/crypto/src/pkix/PkixCertPathBuilderException.cs b/crypto/src/pkix/PkixCertPathBuilderException.cs index 0f10179dd..46845d287 100644 --- a/crypto/src/pkix/PkixCertPathBuilderException.cs +++ b/crypto/src/pkix/PkixCertPathBuilderException.cs @@ -7,7 +7,7 @@ namespace Org.BouncyCastle.Pkix /// <summary> /// Summary description for PkixCertPathBuilderException. /// </summary> -#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE) +#if !PORTABLE [Serializable] #endif public class PkixCertPathBuilderException : GeneralSecurityException diff --git a/crypto/src/pkix/PkixCertPathValidatorException.cs b/crypto/src/pkix/PkixCertPathValidatorException.cs index a477f7dc4..143cdd832 100644 --- a/crypto/src/pkix/PkixCertPathValidatorException.cs +++ b/crypto/src/pkix/PkixCertPathValidatorException.cs @@ -27,7 +27,7 @@ namespace Org.BouncyCastle.Pkix * * @see CertPathValidator **/ -#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE) +#if !PORTABLE [Serializable] #endif public class PkixCertPathValidatorException diff --git a/crypto/src/pkix/PkixNameConstraintValidatorException.cs b/crypto/src/pkix/PkixNameConstraintValidatorException.cs index b187525e0..b6a05246f 100644 --- a/crypto/src/pkix/PkixNameConstraintValidatorException.cs +++ b/crypto/src/pkix/PkixNameConstraintValidatorException.cs @@ -2,7 +2,7 @@ using System; namespace Org.BouncyCastle.Pkix { -#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE) +#if !PORTABLE [Serializable] #endif public class PkixNameConstraintValidatorException diff --git a/crypto/src/security/DotNetUtilities.cs b/crypto/src/security/DotNetUtilities.cs index f0064fb3d..0a83ab88c 100644 --- a/crypto/src/security/DotNetUtilities.cs +++ b/crypto/src/security/DotNetUtilities.cs @@ -1,4 +1,4 @@ -#if !(NETCF_1_0 || SILVERLIGHT || PORTABLE) +#if !PORTABLE using System; using System.Security.Cryptography; diff --git a/crypto/src/security/GeneralSecurityException.cs b/crypto/src/security/GeneralSecurityException.cs index d4ab38cae..c1131f04b 100644 --- a/crypto/src/security/GeneralSecurityException.cs +++ b/crypto/src/security/GeneralSecurityException.cs @@ -2,7 +2,7 @@ using System; namespace Org.BouncyCastle.Security { -#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE) +#if !PORTABLE [Serializable] #endif public class GeneralSecurityException diff --git a/crypto/src/security/InvalidKeyException.cs b/crypto/src/security/InvalidKeyException.cs index ebad9e32f..e9cfa75fd 100644 --- a/crypto/src/security/InvalidKeyException.cs +++ b/crypto/src/security/InvalidKeyException.cs @@ -2,7 +2,7 @@ using System; namespace Org.BouncyCastle.Security { -#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE) +#if !PORTABLE [Serializable] #endif public class InvalidKeyException : KeyException diff --git a/crypto/src/security/InvalidParameterException.cs b/crypto/src/security/InvalidParameterException.cs index 48172f470..27b2ea411 100644 --- a/crypto/src/security/InvalidParameterException.cs +++ b/crypto/src/security/InvalidParameterException.cs @@ -2,7 +2,7 @@ using System; namespace Org.BouncyCastle.Security { -#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE) +#if !PORTABLE [Serializable] #endif public class InvalidParameterException : KeyException diff --git a/crypto/src/security/KeyException.cs b/crypto/src/security/KeyException.cs index e19fa8961..57ce6862b 100644 --- a/crypto/src/security/KeyException.cs +++ b/crypto/src/security/KeyException.cs @@ -2,7 +2,7 @@ using System; namespace Org.BouncyCastle.Security { -#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE) +#if !PORTABLE [Serializable] #endif public class KeyException : GeneralSecurityException diff --git a/crypto/src/security/SecureRandom.cs b/crypto/src/security/SecureRandom.cs index 5019eaf63..3abcc8316 100644 --- a/crypto/src/security/SecureRandom.cs +++ b/crypto/src/security/SecureRandom.cs @@ -14,7 +14,7 @@ namespace Org.BouncyCastle.Security { private static long counter = Times.NanoTime(); -#if NETCF_1_0 || PORTABLE +#if PORTABLE private static object counterLock = new object(); private static long NextCounterValue() { diff --git a/crypto/src/security/SecurityUtilityException.cs b/crypto/src/security/SecurityUtilityException.cs index 8a1953008..d3f97c1a3 100644 --- a/crypto/src/security/SecurityUtilityException.cs +++ b/crypto/src/security/SecurityUtilityException.cs @@ -2,7 +2,7 @@ using System; namespace Org.BouncyCastle.Security { -#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE) +#if !PORTABLE [Serializable] #endif public class SecurityUtilityException diff --git a/crypto/src/security/SignatureException.cs b/crypto/src/security/SignatureException.cs index 3ad617dfd..deaa23432 100644 --- a/crypto/src/security/SignatureException.cs +++ b/crypto/src/security/SignatureException.cs @@ -2,7 +2,7 @@ using System; namespace Org.BouncyCastle.Security { -#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE) +#if !PORTABLE [Serializable] #endif public class SignatureException : GeneralSecurityException diff --git a/crypto/src/security/cert/CertificateEncodingException.cs b/crypto/src/security/cert/CertificateEncodingException.cs index ab9024fc7..20c965630 100644 --- a/crypto/src/security/cert/CertificateEncodingException.cs +++ b/crypto/src/security/cert/CertificateEncodingException.cs @@ -2,7 +2,7 @@ using System; namespace Org.BouncyCastle.Security.Certificates { -#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE) +#if !PORTABLE [Serializable] #endif public class CertificateEncodingException : CertificateException diff --git a/crypto/src/security/cert/CertificateException.cs b/crypto/src/security/cert/CertificateException.cs index 4bbaccfc1..c8819b710 100644 --- a/crypto/src/security/cert/CertificateException.cs +++ b/crypto/src/security/cert/CertificateException.cs @@ -2,7 +2,7 @@ using System; namespace Org.BouncyCastle.Security.Certificates { -#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE) +#if !PORTABLE [Serializable] #endif public class CertificateException : GeneralSecurityException diff --git a/crypto/src/security/cert/CertificateExpiredException.cs b/crypto/src/security/cert/CertificateExpiredException.cs index 864fb85c1..1d12ba7e9 100644 --- a/crypto/src/security/cert/CertificateExpiredException.cs +++ b/crypto/src/security/cert/CertificateExpiredException.cs @@ -2,7 +2,7 @@ using System; namespace Org.BouncyCastle.Security.Certificates { -#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE) +#if !PORTABLE [Serializable] #endif public class CertificateExpiredException : CertificateException diff --git a/crypto/src/security/cert/CertificateNotYetValidException.cs b/crypto/src/security/cert/CertificateNotYetValidException.cs index 02112be98..8de806673 100644 --- a/crypto/src/security/cert/CertificateNotYetValidException.cs +++ b/crypto/src/security/cert/CertificateNotYetValidException.cs @@ -2,7 +2,7 @@ using System; namespace Org.BouncyCastle.Security.Certificates { -#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE) +#if !PORTABLE [Serializable] #endif public class CertificateNotYetValidException : CertificateException diff --git a/crypto/src/security/cert/CertificateParsingException.cs b/crypto/src/security/cert/CertificateParsingException.cs index ae909ca40..1e0a3f47a 100644 --- a/crypto/src/security/cert/CertificateParsingException.cs +++ b/crypto/src/security/cert/CertificateParsingException.cs @@ -2,7 +2,7 @@ using System; namespace Org.BouncyCastle.Security.Certificates { -#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE) +#if !PORTABLE [Serializable] #endif public class CertificateParsingException : CertificateException diff --git a/crypto/src/security/cert/CrlException.cs b/crypto/src/security/cert/CrlException.cs index fe9807e79..4f71bea5f 100644 --- a/crypto/src/security/cert/CrlException.cs +++ b/crypto/src/security/cert/CrlException.cs @@ -2,7 +2,7 @@ using System; namespace Org.BouncyCastle.Security.Certificates { -#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE) +#if !PORTABLE [Serializable] #endif public class CrlException : GeneralSecurityException diff --git a/crypto/src/tls/AbstractTlsContext.cs b/crypto/src/tls/AbstractTlsContext.cs index 0317b1430..be7a67dfc 100644 --- a/crypto/src/tls/AbstractTlsContext.cs +++ b/crypto/src/tls/AbstractTlsContext.cs @@ -13,21 +13,10 @@ namespace Org.BouncyCastle.Tls { private static long counter = Times.NanoTime(); -#if NETCF_1_0 - private static object counterLock = new object(); - private static long NextCounterValue() - { - lock (counterLock) - { - return ++counter; - } - } -#else private static long NextCounterValue() { return Interlocked.Increment(ref counter); } -#endif private static TlsNonceGenerator CreateNonceGenerator(TlsCrypto crypto, int connectionEnd) { diff --git a/crypto/src/tls/TlsUtilities.cs b/crypto/src/tls/TlsUtilities.cs index f0c8ba194..1e0b403c9 100644 --- a/crypto/src/tls/TlsUtilities.cs +++ b/crypto/src/tls/TlsUtilities.cs @@ -5454,11 +5454,7 @@ namespace Org.BouncyCastle.Tls #if !PORTABLE || DOTNET public static bool IsTimeout(SocketException e) { -#if NET_1_1 - return 10060 == e.ErrorCode; -#else return SocketError.TimedOut == e.SocketErrorCode; -#endif } #endif diff --git a/crypto/src/tsp/TSPException.cs b/crypto/src/tsp/TSPException.cs index 0f29b1299..0213490d9 100644 --- a/crypto/src/tsp/TSPException.cs +++ b/crypto/src/tsp/TSPException.cs @@ -2,7 +2,7 @@ using System; namespace Org.BouncyCastle.Tsp { -#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE) +#if !PORTABLE [Serializable] #endif public class TspException diff --git a/crypto/src/tsp/TSPValidationException.cs b/crypto/src/tsp/TSPValidationException.cs index 80f64203b..066a398e4 100644 --- a/crypto/src/tsp/TSPValidationException.cs +++ b/crypto/src/tsp/TSPValidationException.cs @@ -8,7 +8,7 @@ namespace Org.BouncyCastle.Tsp * If a failure code is associated with the exception it can be retrieved using * the getFailureCode() method.</p> */ -#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE) +#if !PORTABLE [Serializable] #endif public class TspValidationException diff --git a/crypto/src/util/Enums.cs b/crypto/src/util/Enums.cs index 9e908c4c0..c369511d4 100644 --- a/crypto/src/util/Enums.cs +++ b/crypto/src/util/Enums.cs @@ -1,7 +1,6 @@ using System; -using System.Text; -#if NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE +#if PORTABLE using System.Collections; using System.Reflection; #endif @@ -23,15 +22,7 @@ namespace Org.BouncyCastle.Utilities s = s.Replace('-', '_'); s = s.Replace('/', '_'); -#if NETCF_1_0 - FieldInfo field = enumType.GetField(s, BindingFlags.Static | BindingFlags.Public); - if (field != null) - { - return (Enum)field.GetValue(null); - } -#else return (Enum)Enum.Parse(enumType, s, false); -#endif } throw new ArgumentException(); @@ -42,21 +33,7 @@ namespace Org.BouncyCastle.Utilities if (!IsEnumType(enumType)) throw new ArgumentException("Not an enumeration type", "enumType"); -#if NETCF_1_0 || NETCF_2_0 || SILVERLIGHT - IList result = Platform.CreateArrayList(); - FieldInfo[] fields = enumType.GetFields(BindingFlags.Static | BindingFlags.Public); - foreach (FieldInfo field in fields) - { - // Note: Argument to GetValue() ignored since the fields are static, - // but Silverlight for Windows Phone throws exception if we pass null - result.Add(field.GetValue(enumType)); - } - object[] arr = new object[result.Count]; - result.CopyTo(arr, 0); - return arr; -#else return Enum.GetValues(enumType); -#endif } internal static Enum GetArbitraryValue(System.Type enumType) diff --git a/crypto/src/util/Platform.cs b/crypto/src/util/Platform.cs index 547cef3fa..b0cd5dcb7 100644 --- a/crypto/src/util/Platform.cs +++ b/crypto/src/util/Platform.cs @@ -3,7 +3,7 @@ using System.Globalization; using System.IO; using System.Text; -#if SILVERLIGHT || PORTABLE +#if PORTABLE using System.Collections.Generic; #else using System.Collections; @@ -15,22 +15,10 @@ namespace Org.BouncyCastle.Utilities { private static readonly CompareInfo InvariantCompareInfo = CultureInfo.InvariantCulture.CompareInfo; -#if NETCF_1_0 || NETCF_2_0 - private static string GetNewLine() - { - MemoryStream buf = new MemoryStream(); - StreamWriter w = new StreamWriter(buf, Encoding.UTF8); - w.WriteLine(); - Dispose(w); - byte[] bs = buf.ToArray(); - return Encoding.UTF8.GetString(bs, 0, bs.Length); - } -#else private static string GetNewLine() { return Environment.NewLine; } -#endif internal static bool EqualsIgnoreCase(string a, string b) { @@ -41,7 +29,7 @@ namespace Org.BouncyCastle.Utilities #endif } -#if NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || (PORTABLE && !DOTNET) +#if PORTABLE && !DOTNET internal static string GetEnvironmentVariable( string variable) { @@ -64,28 +52,13 @@ namespace Org.BouncyCastle.Utilities } #endif -#if NETCF_1_0 - internal static Exception CreateNotImplementedException( - string message) - { - return new Exception("Not implemented: " + message); - } - - internal static bool Equals( - object a, - object b) - { - return a == b || (a != null && b != null && a.Equals(b)); - } -#else internal static Exception CreateNotImplementedException( string message) { return new NotImplementedException(message); } -#endif -#if SILVERLIGHT || PORTABLE +#if PORTABLE internal static System.Collections.IList CreateArrayList() { return new List<object>(); diff --git a/crypto/src/util/Strings.cs b/crypto/src/util/Strings.cs index 73a15ea73..83d1f13fb 100644 --- a/crypto/src/util/Strings.cs +++ b/crypto/src/util/Strings.cs @@ -77,7 +77,7 @@ namespace Org.BouncyCastle.Utilities public static string FromAsciiByteArray( byte[] bytes) { -#if SILVERLIGHT || PORTABLE +#if PORTABLE // TODO Check for non-ASCII bytes in input? return Encoding.UTF8.GetString(bytes, 0, bytes.Length); #else @@ -88,7 +88,7 @@ namespace Org.BouncyCastle.Utilities public static byte[] ToAsciiByteArray( char[] cs) { -#if SILVERLIGHT || PORTABLE +#if PORTABLE // TODO Check for non-ASCII characters in input? return Encoding.UTF8.GetBytes(cs); #else @@ -99,7 +99,7 @@ namespace Org.BouncyCastle.Utilities public static byte[] ToAsciiByteArray( string s) { -#if SILVERLIGHT || PORTABLE +#if PORTABLE // TODO Check for non-ASCII characters in input? return Encoding.UTF8.GetBytes(s); #else diff --git a/crypto/src/util/io/StreamOverflowException.cs b/crypto/src/util/io/StreamOverflowException.cs index 36d21e23e..7e100e7b5 100644 --- a/crypto/src/util/io/StreamOverflowException.cs +++ b/crypto/src/util/io/StreamOverflowException.cs @@ -3,7 +3,7 @@ using System.IO; namespace Org.BouncyCastle.Utilities.IO { -#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE) +#if !PORTABLE [Serializable] #endif public class StreamOverflowException diff --git a/crypto/src/util/io/pem/PemGenerationException.cs b/crypto/src/util/io/pem/PemGenerationException.cs index 6b3958577..a49dda0e7 100644 --- a/crypto/src/util/io/pem/PemGenerationException.cs +++ b/crypto/src/util/io/pem/PemGenerationException.cs @@ -2,7 +2,7 @@ using System; namespace Org.BouncyCastle.Utilities.IO.Pem { -#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE) +#if !PORTABLE [Serializable] #endif public class PemGenerationException diff --git a/crypto/src/x509/store/IX509Selector.cs b/crypto/src/x509/store/IX509Selector.cs index 75358cbbf..4459903e7 100644 --- a/crypto/src/x509/store/IX509Selector.cs +++ b/crypto/src/x509/store/IX509Selector.cs @@ -3,11 +3,11 @@ using System; namespace Org.BouncyCastle.X509.Store { public interface IX509Selector -#if !(SILVERLIGHT || PORTABLE) +#if !PORTABLE : ICloneable #endif { -#if SILVERLIGHT || PORTABLE +#if PORTABLE object Clone(); #endif bool Match(object obj); diff --git a/crypto/src/x509/store/NoSuchStoreException.cs b/crypto/src/x509/store/NoSuchStoreException.cs index 28b18892a..bf6bdf76c 100644 --- a/crypto/src/x509/store/NoSuchStoreException.cs +++ b/crypto/src/x509/store/NoSuchStoreException.cs @@ -2,7 +2,7 @@ using System; namespace Org.BouncyCastle.X509.Store { -#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE) +#if !PORTABLE [Serializable] #endif public class NoSuchStoreException diff --git a/crypto/src/x509/store/X509StoreException.cs b/crypto/src/x509/store/X509StoreException.cs index ea7e51e79..f697c116a 100644 --- a/crypto/src/x509/store/X509StoreException.cs +++ b/crypto/src/x509/store/X509StoreException.cs @@ -2,7 +2,7 @@ using System; namespace Org.BouncyCastle.X509.Store { -#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE) +#if !PORTABLE [Serializable] #endif public class X509StoreException |