Merge pull request #1902 from MediaBrowser/dev

update namespaces
This commit is contained in:
Luke 2016-06-30 18:08:14 -04:00 committed by GitHub
commit 55de77ca28
17 changed files with 117 additions and 242 deletions

View File

@ -1,8 +1,8 @@
using MediaBrowser.Model.Logging;
using Mono.Security.X509;
using System;
using System.Collections;
using System.Security.Cryptography;
using MediaBrowser.Server.Mono.Security;
namespace MediaBrowser.Server.Mono.Networking
{

View File

@ -34,18 +34,13 @@ using System.Collections;
using System.IO;
using System.Text;
namespace Mono.Security {
namespace MediaBrowser.Server.Mono.Security {
// References:
// a. ITU ASN.1 standards (free download)
// http://www.itu.int/ITU-T/studygroups/com17/languages/
#if INSIDE_CORLIB
internal
#else
public
#endif
class ASN1 {
public class ASN1 {
private byte m_nTag;
private byte[] m_aValue;

View File

@ -30,23 +30,17 @@
//
using System;
using System.Collections;
using System.Globalization;
using System.Security.Cryptography;
using System.Text;
namespace Mono.Security {
namespace MediaBrowser.Server.Mono.Security {
// References:
// a. ITU ASN.1 standards (free download)
// http://www.itu.int/ITU-T/studygroups/com17/languages/
#if INSIDE_CORLIB
internal
#else
public
#endif
static class ASN1Convert {
public static class ASN1Convert {
// RFC3280, section 4.2.1.5
// CAs conforming to this profile MUST always encode certificate
// validity dates through the year 2049 as UTCTime; certificate validity

View File

@ -29,7 +29,7 @@
using System;
namespace Mono.Security
namespace MediaBrowser.Server.Mono.Security
{
internal sealed class BitConverterLE
{

View File

@ -32,14 +32,9 @@ using System.Globalization;
using System.Security.Cryptography;
using System.Text;
namespace Mono.Security.Cryptography {
namespace MediaBrowser.Server.Mono.Security {
#if INSIDE_CORLIB
internal
#else
public
#endif
sealed class CryptoConvert {
public sealed class CryptoConvert {
private CryptoConvert ()
{
@ -166,31 +161,30 @@ namespace Mono.Security.Cryptography {
throw new CryptographicException ("Invalid blob.", e);
}
#if INSIDE_CORLIB && MOBILE
RSA rsa = RSA.Create ();
rsa.ImportParameters (rsap);
#else
RSA rsa = null;
try {
try
{
rsa = RSA.Create();
rsa.ImportParameters(rsap);
}
catch (CryptographicException ce) {
catch (CryptographicException ce)
{
// this may cause problem when this code is run under
// the SYSTEM identity on Windows (e.g. ASP.NET). See
// http://bugzilla.ximian.com/show_bug.cgi?id=77559
try {
try
{
CspParameters csp = new CspParameters();
csp.Flags = CspProviderFlags.UseMachineKeyStore;
rsa = new RSACryptoServiceProvider(csp);
rsa.ImportParameters(rsap);
}
catch {
catch
{
// rethrow original, not the later, exception if this fails
throw ce;
}
}
#endif
return rsa;
}
@ -251,31 +245,30 @@ namespace Mono.Security.Cryptography {
throw new CryptographicException ("Invalid blob.", e);
}
#if INSIDE_CORLIB && MOBILE
DSA dsa = (DSA)DSA.Create ();
dsa.ImportParameters (dsap);
#else
DSA dsa = null;
try {
try
{
dsa = (DSA)DSA.Create();
dsa.ImportParameters(dsap);
}
catch (CryptographicException ce) {
catch (CryptographicException ce)
{
// this may cause problem when this code is run under
// the SYSTEM identity on Windows (e.g. ASP.NET). See
// http://bugzilla.ximian.com/show_bug.cgi?id=77559
try {
try
{
CspParameters csp = new CspParameters();
csp.Flags = CspProviderFlags.UseMachineKeyStore;
dsa = new DSACryptoServiceProvider(csp);
dsa.ImportParameters(dsap);
}
catch {
catch
{
// rethrow original, not the later, exception if this fails
throw ce;
}
}
#endif
return dsa;
}
@ -444,16 +437,14 @@ namespace Mono.Security.Cryptography {
rsap.Modulus = new byte [byteLen];
Buffer.BlockCopy (blob, pos, rsap.Modulus, 0, byteLen);
Array.Reverse (rsap.Modulus);
#if INSIDE_CORLIB && MOBILE
RSA rsa = RSA.Create ();
rsa.ImportParameters (rsap);
#else
RSA rsa = null;
try {
try
{
rsa = RSA.Create();
rsa.ImportParameters(rsap);
}
catch (CryptographicException) {
catch (CryptographicException)
{
// this may cause problem when this code is run under
// the SYSTEM identity on Windows (e.g. ASP.NET). See
// http://bugzilla.ximian.com/show_bug.cgi?id=77559
@ -462,7 +453,6 @@ namespace Mono.Security.Cryptography {
rsa = new RSACryptoServiceProvider(csp);
rsa.ImportParameters(rsap);
}
#endif
return rsa;
}
catch (Exception e) {

View File

@ -31,18 +31,13 @@
using System;
using System.Security.Cryptography;
namespace Mono.Security.Cryptography {
namespace MediaBrowser.Server.Mono.Security {
// References:
// a. PKCS#1: RSA Cryptography Standard
// http://www.rsasecurity.com/rsalabs/pkcs/pkcs-1/index.html
#if INSIDE_CORLIB
internal
#else
public
#endif
sealed class PKCS1 {
public sealed class PKCS1 {
private PKCS1 ()
{

View File

@ -37,17 +37,9 @@ using System.IO;
using System.Security.Cryptography;
using System.Text;
using Mono.Security;
using Mono.Security.Cryptography;
namespace MediaBrowser.Server.Mono.Security {
namespace Mono.Security.X509 {
#if INSIDE_CORLIB
internal
#else
public
#endif
class PKCS5 {
public class PKCS5 {
public const string pbeWithMD2AndDESCBC = "1.2.840.113549.1.5.1";
public const string pbeWithMD5AndDESCBC = "1.2.840.113549.1.5.3";
@ -59,12 +51,7 @@ namespace Mono.Security.X509 {
public PKCS5 () {}
}
#if INSIDE_CORLIB
internal
#else
public
#endif
class PKCS9 {
public class PKCS9 {
public const string friendlyName = "1.2.840.113549.1.9.20";
public const string localKeyId = "1.2.840.113549.1.9.21";
@ -92,12 +79,7 @@ namespace Mono.Security.X509 {
}
#if INSIDE_CORLIB
internal
#else
public
#endif
class PKCS12 : ICloneable {
public class PKCS12 : ICloneable {
public const string pbeWithSHAAnd128BitRC4 = "1.2.840.113549.1.12.1.1";
public const string pbeWithSHAAnd40BitRC4 = "1.2.840.113549.1.12.1.2";
@ -657,28 +639,7 @@ namespace Mono.Security.X509 {
}
SymmetricAlgorithm sa = null;
#if INSIDE_CORLIB && FULL_AOT_RUNTIME
// we do not want CryptoConfig to bring the whole crypto stack
// in particular Rijndael which is not supported by CommonCrypto
switch (algorithm) {
case "DES":
sa = DES.Create ();
break;
case "RC2":
sa = RC2.Create ();
break;
case "TripleDES":
sa = TripleDES.Create ();
break;
case "RC4":
sa = RC4.Create ();
break;
default:
throw new NotSupportedException (algorithm);
}
#else
sa = SymmetricAlgorithm.Create(algorithm);
#endif
sa.Key = pd.DeriveKey (keyLength);
// IV required only for block ciphers (not stream ciphers)
if (ivLength > 0) {

View File

@ -33,16 +33,9 @@ using System;
using System.Collections;
using System.Security.Cryptography;
using Mono.Security.X509;
namespace MediaBrowser.Server.Mono.Security {
namespace Mono.Security {
#if INSIDE_CORLIB
internal
#else
public
#endif
sealed class PKCS7 {
public sealed class PKCS7 {
public class Oid {
// pkcs 1

View File

@ -33,14 +33,9 @@ using System;
using System.Collections;
using System.Security.Cryptography;
using Mono.Security.X509;
namespace MediaBrowser.Server.Mono.Security {
namespace Mono.Security.Cryptography {
#if !INSIDE_CORLIB
public
#endif
sealed class PKCS8 {
public sealed class PKCS8 {
public enum KeyInfo {
PrivateKey,
@ -277,11 +272,6 @@ namespace Mono.Security.Cryptography {
rsa.ImportParameters (param);
}
catch (CryptographicException) {
#if MONOTOUCH
// there's no machine-wide store available for iOS so we can drop the dependency on
// CspParameters (which drops other things, like XML key persistance, unless used elsewhere)
throw;
#else
// this may cause problem when this code is run under
// the SYSTEM identity on Windows (e.g. ASP.NET). See
// http://bugzilla.ximian.com/show_bug.cgi?id=77559
@ -289,7 +279,6 @@ namespace Mono.Security.Cryptography {
csp.Flags = CspProviderFlags.UseMachineKeyStore;
rsa = new RSACryptoServiceProvider(csp);
rsa.ImportParameters(param);
#endif
}
return rsa;
}

View File

@ -31,10 +31,7 @@ using System;
using System.Globalization;
using System.Text;
using Mono.Security;
using Mono.Security.Cryptography;
namespace Mono.Security.X509 {
namespace MediaBrowser.Server.Mono.Security {
// References:
// 1. Information technology - Open Systems Interconnection - The Directory: Models
@ -49,12 +46,7 @@ namespace Mono.Security.X509 {
*
* RelativeDistinguishedName ::= SET OF AttributeTypeAndValue
*/
#if INSIDE_CORLIB
internal
#else
public
#endif
sealed class X501 {
public sealed class X501 {
static byte[] countryName = { 0x55, 0x04, 0x06 };
static byte[] organizationName = { 0x55, 0x04, 0x0A };

View File

@ -33,9 +33,7 @@ using System;
using System.Globalization;
using System.Security.Cryptography;
using Mono.Security;
namespace Mono.Security.X509 {
namespace MediaBrowser.Server.Mono.Security {
public abstract class X509Builder {

View File

@ -31,12 +31,10 @@
using System;
using System.Runtime.Serialization;
using System.Security.Cryptography;
using SSCX = System.Security.Cryptography.X509Certificates;
using System.Security.Permissions;
using System.Text;
using Mono.Security.Cryptography;
namespace Mono.Security.X509 {
namespace MediaBrowser.Server.Mono.Security {
// References:
// a. Internet X.509 Public Key Infrastructure Certificate and CRL Profile
@ -44,11 +42,8 @@ namespace Mono.Security.X509 {
// b. ITU ASN.1 standards (free download)
// http://www.itu.int/ITU-T/studygroups/com17/languages/
#if INSIDE_CORLIB
internal class X509Certificate : ISerializable {
#else
public class X509Certificate : ISerializable {
#endif
public class X509Certificate : ISerializable
{
private ASN1 decoder;

View File

@ -32,7 +32,7 @@
using System;
using System.Security.Cryptography;
namespace Mono.Security.X509 {
namespace MediaBrowser.Server.Mono.Security {
// From RFC3280
/*
* Certificate ::= SEQUENCE {

View File

@ -31,15 +31,10 @@
using System;
using System.Collections;
namespace Mono.Security.X509 {
namespace MediaBrowser.Server.Mono.Security {
[Serializable]
#if INSIDE_CORLIB
internal
#else
public
#endif
class X509CertificateCollection : CollectionBase, IEnumerable {
public class X509CertificateCollection : CollectionBase, IEnumerable {
public X509CertificateCollection ()
{

View File

@ -31,9 +31,7 @@ using System;
using System.Globalization;
using System.Text;
using Mono.Security;
namespace Mono.Security.X509 {
namespace MediaBrowser.Server.Mono.Security {
/*
* Extension ::= SEQUENCE {
* extnID OBJECT IDENTIFIER,
@ -41,12 +39,7 @@ namespace Mono.Security.X509 {
* extnValue OCTET STRING
* }
*/
#if INSIDE_CORLIB
internal
#else
public
#endif
class X509Extension {
public class X509Extension {
protected string extnOid;
protected bool extnCritical;

View File

@ -32,20 +32,13 @@
using System;
using System.Collections;
using Mono.Security;
namespace Mono.Security.X509 {
namespace MediaBrowser.Server.Mono.Security {
/*
* Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension
*
* Note: 1..MAX -> There shouldn't be 0 Extensions in the ASN1 structure
*/
#if INSIDE_CORLIB
internal
#else
public
#endif
sealed class X509ExtensionCollection : CollectionBase, IEnumerable {
public sealed class X509ExtensionCollection : CollectionBase, IEnumerable {
private bool readOnly;

View File

@ -28,12 +28,9 @@
//
using System;
using System.Globalization;
using System.Text;
using Mono.Security;
namespace Mono.Security.X509 {
namespace MediaBrowser.Server.Mono.Security {
// References:
// 1. Information technology - Open Systems Interconnection - The Directory: Selected attribute types
@ -55,12 +52,7 @@ namespace Mono.Security.X509 {
*
* AttributeValue ::= ANY DEFINED BY AttributeType
*/
#if INSIDE_CORLIB
internal
#else
public
#endif
class X520 {
public class X520 {
public abstract class AttributeTypeAndValue {
private string oid;