svcGen)
40 | {
41 | this.svcGen = svcGen;
42 | }
43 |
44 | public IService Give()
45 | {
46 | return svcGen();
47 | }
48 | }
49 | }
50 |
51 |
--------------------------------------------------------------------------------
/src/Binsync.Core/Services/IService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Binsync.Core.Services
4 | {
5 | public interface IService
6 | {
7 | bool Connected { get; }
8 |
9 | bool Connect();
10 |
11 | byte[] GetSubject(string id);
12 | byte[] GetBody(string id);
13 |
14 | bool Upload(Chunk chunk);
15 | }
16 | }
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/Binsync.Dependencies.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 | EMIT_ASSEMBLY_INFO;COREFX;FEAT_SAFE
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/ASN1Generator.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.IO;
3 |
4 | namespace Org.BouncyCastle.Asn1
5 | {
6 | public abstract class Asn1Generator
7 | {
8 | private Stream _out;
9 |
10 | protected Asn1Generator(
11 | Stream outStream)
12 | {
13 | _out = outStream;
14 | }
15 |
16 | protected Stream Out
17 | {
18 | get { return _out; }
19 | }
20 |
21 | public abstract void AddObject(Asn1Encodable obj);
22 |
23 | public abstract Stream GetRawOutputStream();
24 |
25 | public abstract void Close();
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/ASN1OctetStringParser.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 |
3 | namespace Org.BouncyCastle.Asn1
4 | {
5 | public interface Asn1OctetStringParser
6 | : IAsn1Convertible
7 | {
8 | Stream GetOctetStream();
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/ASN1SequenceParser.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Asn1
2 | {
3 | public interface Asn1SequenceParser
4 | : IAsn1Convertible
5 | {
6 | IAsn1Convertible ReadObject();
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/ASN1SetParser.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Asn1
2 | {
3 | public interface Asn1SetParser
4 | : IAsn1Convertible
5 | {
6 | IAsn1Convertible ReadObject();
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/ASN1TaggedObjectParser.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Asn1
2 | {
3 | public interface Asn1TaggedObjectParser
4 | : IAsn1Convertible
5 | {
6 | int TagNo { get; }
7 |
8 | IAsn1Convertible GetObjectParser(int tag, bool isExplicit);
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/Asn1Exception.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | namespace Org.BouncyCastle.Asn1
5 | {
6 | public class Asn1Exception
7 | : IOException
8 | {
9 | public Asn1Exception()
10 | : base()
11 | {
12 | }
13 |
14 | public Asn1Exception(
15 | string message)
16 | : base(message)
17 | {
18 | }
19 |
20 | public Asn1Exception(
21 | string message,
22 | Exception exception)
23 | : base(message, exception)
24 | {
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/Asn1Null.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Asn1
2 | {
3 | /**
4 | * A Null object.
5 | */
6 | public abstract class Asn1Null
7 | : Asn1Object
8 | {
9 | internal Asn1Null()
10 | {
11 | }
12 |
13 | public override string ToString()
14 | {
15 | return "NULL";
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/Asn1OutputStream.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | namespace Org.BouncyCastle.Asn1
5 | {
6 | public class Asn1OutputStream
7 | : DerOutputStream
8 | {
9 | public Asn1OutputStream(Stream os) : base(os)
10 | {
11 | }
12 |
13 | [Obsolete("Use version taking an Asn1Encodable arg instead")]
14 | public override void WriteObject(
15 | object obj)
16 | {
17 | if (obj == null)
18 | {
19 | WriteNull();
20 | }
21 | else if (obj is Asn1Object)
22 | {
23 | ((Asn1Object)obj).Encode(this);
24 | }
25 | else if (obj is Asn1Encodable)
26 | {
27 | ((Asn1Encodable)obj).ToAsn1Object().Encode(this);
28 | }
29 | else
30 | {
31 | throw new IOException("object not Asn1Encodable");
32 | }
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/Asn1ParsingException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Asn1
4 | {
5 | public class Asn1ParsingException
6 | : InvalidOperationException
7 | {
8 | public Asn1ParsingException()
9 | : base()
10 | {
11 | }
12 |
13 | public Asn1ParsingException(
14 | string message)
15 | : base(message)
16 | {
17 | }
18 |
19 | public Asn1ParsingException(
20 | string message,
21 | Exception exception)
22 | : base(message, exception)
23 | {
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/BEROctetStringParser.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | using Org.BouncyCastle.Utilities.IO;
5 |
6 | namespace Org.BouncyCastle.Asn1
7 | {
8 | public class BerOctetStringParser
9 | : Asn1OctetStringParser
10 | {
11 | private readonly Asn1StreamParser _parser;
12 |
13 | internal BerOctetStringParser(
14 | Asn1StreamParser parser)
15 | {
16 | _parser = parser;
17 | }
18 |
19 | public Stream GetOctetStream()
20 | {
21 | return new ConstructedOctetStream(_parser);
22 | }
23 |
24 | public Asn1Object ToAsn1Object()
25 | {
26 | try
27 | {
28 | return new BerOctetString(Streams.ReadAll(GetOctetStream()));
29 | }
30 | catch (IOException e)
31 | {
32 | throw new Asn1ParsingException("IOException converting stream to byte array: " + e.Message, e);
33 | }
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/BERSequenceGenerator.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 |
3 | namespace Org.BouncyCastle.Asn1
4 | {
5 | public class BerSequenceGenerator
6 | : BerGenerator
7 | {
8 | public BerSequenceGenerator(
9 | Stream outStream)
10 | : base(outStream)
11 | {
12 | WriteBerHeader(Asn1Tags.Constructed | Asn1Tags.Sequence);
13 | }
14 |
15 | public BerSequenceGenerator(
16 | Stream outStream,
17 | int tagNo,
18 | bool isExplicit)
19 | : base(outStream, tagNo, isExplicit)
20 | {
21 | WriteBerHeader(Asn1Tags.Constructed | Asn1Tags.Sequence);
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/BERSequenceParser.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Asn1
2 | {
3 | public class BerSequenceParser
4 | : Asn1SequenceParser
5 | {
6 | private readonly Asn1StreamParser _parser;
7 |
8 | internal BerSequenceParser(
9 | Asn1StreamParser parser)
10 | {
11 | this._parser = parser;
12 | }
13 |
14 | public IAsn1Convertible ReadObject()
15 | {
16 | return _parser.ReadObject();
17 | }
18 |
19 | public Asn1Object ToAsn1Object()
20 | {
21 | return new BerSequence(_parser.ReadVector());
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/BERSetGenerator.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 |
3 | namespace Org.BouncyCastle.Asn1
4 | {
5 | public class BerSetGenerator
6 | : BerGenerator
7 | {
8 | public BerSetGenerator(
9 | Stream outStream)
10 | : base(outStream)
11 | {
12 | WriteBerHeader(Asn1Tags.Constructed | Asn1Tags.Set);
13 | }
14 |
15 | public BerSetGenerator(
16 | Stream outStream,
17 | int tagNo,
18 | bool isExplicit)
19 | : base(outStream, tagNo, isExplicit)
20 | {
21 | WriteBerHeader(Asn1Tags.Constructed | Asn1Tags.Set);
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/BERSetParser.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Asn1
2 | {
3 | public class BerSetParser
4 | : Asn1SetParser
5 | {
6 | private readonly Asn1StreamParser _parser;
7 |
8 | internal BerSetParser(
9 | Asn1StreamParser parser)
10 | {
11 | this._parser = parser;
12 | }
13 |
14 | public IAsn1Convertible ReadObject()
15 | {
16 | return _parser.ReadObject();
17 | }
18 |
19 | public Asn1Object ToAsn1Object()
20 | {
21 | return new BerSet(_parser.ReadVector(), false);
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/BerApplicationSpecific.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Asn1
4 | {
5 | public class BerApplicationSpecific
6 | : DerApplicationSpecific
7 | {
8 | public BerApplicationSpecific(
9 | int tagNo,
10 | Asn1EncodableVector vec)
11 | : base(tagNo, vec)
12 | {
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/BerApplicationSpecificParser.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Asn1
4 | {
5 | public class BerApplicationSpecificParser
6 | : IAsn1ApplicationSpecificParser
7 | {
8 | private readonly int tag;
9 | private readonly Asn1StreamParser parser;
10 |
11 | internal BerApplicationSpecificParser(
12 | int tag,
13 | Asn1StreamParser parser)
14 | {
15 | this.tag = tag;
16 | this.parser = parser;
17 | }
18 |
19 | public IAsn1Convertible ReadObject()
20 | {
21 | return parser.ReadObject();
22 | }
23 |
24 | public Asn1Object ToAsn1Object()
25 | {
26 | return new BerApplicationSpecific(tag, parser.ReadVector());
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/BerNull.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Asn1
4 | {
5 | /**
6 | * A BER Null object.
7 | */
8 | public class BerNull
9 | : DerNull
10 | {
11 | public static new readonly BerNull Instance = new BerNull(0);
12 |
13 | [Obsolete("Use static Instance object")]
14 | public BerNull()
15 | {
16 | }
17 |
18 | private BerNull(int dummy) : base(dummy)
19 | {
20 | }
21 |
22 | internal override void Encode(
23 | DerOutputStream derOut)
24 | {
25 | if (derOut is Asn1OutputStream || derOut is BerOutputStream)
26 | {
27 | derOut.WriteByte(Asn1Tags.Null);
28 | }
29 | else
30 | {
31 | base.Encode(derOut);
32 | }
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/BerOutputStream.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | namespace Org.BouncyCastle.Asn1
5 | {
6 | // TODO Make Obsolete in favour of Asn1OutputStream?
7 | public class BerOutputStream
8 | : DerOutputStream
9 | {
10 | public BerOutputStream(Stream os) : base(os)
11 | {
12 | }
13 |
14 | [Obsolete("Use version taking an Asn1Encodable arg instead")]
15 | public override void WriteObject(
16 | object obj)
17 | {
18 | if (obj == null)
19 | {
20 | WriteNull();
21 | }
22 | else if (obj is Asn1Object)
23 | {
24 | ((Asn1Object)obj).Encode(this);
25 | }
26 | else if (obj is Asn1Encodable)
27 | {
28 | ((Asn1Encodable)obj).ToAsn1Object().Encode(this);
29 | }
30 | else
31 | {
32 | throw new IOException("object not BerEncodable");
33 | }
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/DERExternalParser.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | namespace Org.BouncyCastle.Asn1
5 | {
6 | public class DerExternalParser
7 | : Asn1Encodable
8 | {
9 | private readonly Asn1StreamParser _parser;
10 |
11 | public DerExternalParser(Asn1StreamParser parser)
12 | {
13 | this._parser = parser;
14 | }
15 |
16 | public IAsn1Convertible ReadObject()
17 | {
18 | return _parser.ReadObject();
19 | }
20 |
21 | public override Asn1Object ToAsn1Object()
22 | {
23 | return new DerExternal(_parser.ReadVector());
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/DEROctetStringParser.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | using Org.BouncyCastle.Utilities.IO;
5 |
6 | namespace Org.BouncyCastle.Asn1
7 | {
8 | public class DerOctetStringParser
9 | : Asn1OctetStringParser
10 | {
11 | private readonly DefiniteLengthInputStream stream;
12 |
13 | internal DerOctetStringParser(
14 | DefiniteLengthInputStream stream)
15 | {
16 | this.stream = stream;
17 | }
18 |
19 | public Stream GetOctetStream()
20 | {
21 | return stream;
22 | }
23 |
24 | public Asn1Object ToAsn1Object()
25 | {
26 | try
27 | {
28 | return new DerOctetString(stream.ToArray());
29 | }
30 | catch (IOException e)
31 | {
32 | throw new InvalidOperationException("IOException converting stream to byte array: " + e.Message, e);
33 | }
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/DERSequenceGenerator.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 |
3 | namespace Org.BouncyCastle.Asn1
4 | {
5 | public class DerSequenceGenerator
6 | : DerGenerator
7 | {
8 | private readonly MemoryStream _bOut = new MemoryStream();
9 |
10 | public DerSequenceGenerator(
11 | Stream outStream)
12 | : base(outStream)
13 | {
14 | }
15 |
16 | public DerSequenceGenerator(
17 | Stream outStream,
18 | int tagNo,
19 | bool isExplicit)
20 | : base(outStream, tagNo, isExplicit)
21 | {
22 | }
23 |
24 | public override void AddObject(
25 | Asn1Encodable obj)
26 | {
27 | new DerOutputStream(_bOut).WriteObject(obj);
28 | }
29 |
30 | public override Stream GetRawOutputStream()
31 | {
32 | return _bOut;
33 | }
34 |
35 | public override void Close()
36 | {
37 | WriteDerEncoded(Asn1Tags.Constructed | Asn1Tags.Sequence, _bOut.ToArray());
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/DERSequenceParser.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Asn1
2 | {
3 | public class DerSequenceParser
4 | : Asn1SequenceParser
5 | {
6 | private readonly Asn1StreamParser _parser;
7 |
8 | internal DerSequenceParser(
9 | Asn1StreamParser parser)
10 | {
11 | this._parser = parser;
12 | }
13 |
14 | public IAsn1Convertible ReadObject()
15 | {
16 | return _parser.ReadObject();
17 | }
18 |
19 | public Asn1Object ToAsn1Object()
20 | {
21 | return new DerSequence(_parser.ReadVector());
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/DERSetGenerator.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 |
3 | namespace Org.BouncyCastle.Asn1
4 | {
5 | public class DerSetGenerator
6 | : DerGenerator
7 | {
8 | private readonly MemoryStream _bOut = new MemoryStream();
9 |
10 | public DerSetGenerator(
11 | Stream outStream)
12 | : base(outStream)
13 | {
14 | }
15 |
16 | public DerSetGenerator(
17 | Stream outStream,
18 | int tagNo,
19 | bool isExplicit)
20 | : base(outStream, tagNo, isExplicit)
21 | {
22 | }
23 |
24 | public override void AddObject(
25 | Asn1Encodable obj)
26 | {
27 | new DerOutputStream(_bOut).WriteObject(obj);
28 | }
29 |
30 | public override Stream GetRawOutputStream()
31 | {
32 | return _bOut;
33 | }
34 |
35 | public override void Close()
36 | {
37 | WriteDerEncoded(Asn1Tags.Constructed | Asn1Tags.Set, _bOut.ToArray());
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/DERSetParser.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Asn1
2 | {
3 | public class DerSetParser
4 | : Asn1SetParser
5 | {
6 | private readonly Asn1StreamParser _parser;
7 |
8 | internal DerSetParser(
9 | Asn1StreamParser parser)
10 | {
11 | this._parser = parser;
12 | }
13 |
14 | public IAsn1Convertible ReadObject()
15 | {
16 | return _parser.ReadObject();
17 | }
18 |
19 | public Asn1Object ToAsn1Object()
20 | {
21 | return new DerSet(_parser.ReadVector(), false);
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/DerNull.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Asn1
4 | {
5 | /**
6 | * A Null object.
7 | */
8 | public class DerNull
9 | : Asn1Null
10 | {
11 | public static readonly DerNull Instance = new DerNull(0);
12 |
13 | byte[] zeroBytes = new byte[0];
14 |
15 | [Obsolete("Use static Instance object")]
16 | public DerNull()
17 | {
18 | }
19 |
20 | protected internal DerNull(int dummy)
21 | {
22 | }
23 |
24 | internal override void Encode(
25 | DerOutputStream derOut)
26 | {
27 | derOut.WriteEncoded(Asn1Tags.Null, zeroBytes);
28 | }
29 |
30 | protected override bool Asn1Equals(
31 | Asn1Object asn1Object)
32 | {
33 | return asn1Object is DerNull;
34 | }
35 |
36 | protected override int Asn1GetHashCode()
37 | {
38 | return -1;
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/DerOctetString.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Asn1
2 | {
3 | public class DerOctetString
4 | : Asn1OctetString
5 | {
6 | /// The octets making up the octet string.
7 | public DerOctetString(
8 | byte[] str)
9 | : base(str)
10 | {
11 | }
12 |
13 | public DerOctetString(
14 | Asn1Encodable obj)
15 | : base(obj)
16 | {
17 | }
18 |
19 | internal override void Encode(
20 | DerOutputStream derOut)
21 | {
22 | derOut.WriteEncoded(Asn1Tags.OctetString, str);
23 | }
24 |
25 | internal static void Encode(
26 | DerOutputStream derOut,
27 | byte[] bytes,
28 | int offset,
29 | int length)
30 | {
31 | derOut.WriteEncoded(Asn1Tags.OctetString, bytes, offset, length);
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/DerStringBase.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Asn1
2 | {
3 | public abstract class DerStringBase
4 | : Asn1Object, IAsn1String
5 | {
6 | protected DerStringBase()
7 | {
8 | }
9 |
10 | public abstract string GetString();
11 |
12 | public override string ToString()
13 | {
14 | return GetString();
15 | }
16 |
17 | protected override int Asn1GetHashCode()
18 | {
19 | return GetString().GetHashCode();
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/IAsn1ApplicationSpecificParser.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Asn1
4 | {
5 | public interface IAsn1ApplicationSpecificParser
6 | : IAsn1Convertible
7 | {
8 | IAsn1Convertible ReadObject();
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/IAsn1Choice.cs:
--------------------------------------------------------------------------------
1 |
2 | namespace Org.BouncyCastle.Asn1
3 | {
4 | /**
5 | * Marker interface for CHOICE objects - if you implement this in a roll-your-own
6 | * object, any attempt to tag the object implicitly will convert the tag to an
7 | * explicit one as the encoding rules require.
8 | *
9 | * If you use this interface your class should also implement the getInstance
10 | * pattern which takes a tag object and the tagging mode used.
11 | *
12 | */
13 | public interface IAsn1Choice
14 | {
15 | // marker interface
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/IAsn1Convertible.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Asn1
2 | {
3 | public interface IAsn1Convertible
4 | {
5 | Asn1Object ToAsn1Object();
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/IAsn1String.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Asn1
2 | {
3 | /**
4 | * basic interface for Der string objects.
5 | */
6 | public interface IAsn1String
7 | {
8 | string GetString();
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/LazyASN1InputStream.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | namespace Org.BouncyCastle.Asn1
5 | {
6 | public class LazyAsn1InputStream
7 | : Asn1InputStream
8 | {
9 | public LazyAsn1InputStream(
10 | byte[] input)
11 | : base(input)
12 | {
13 | }
14 |
15 | public LazyAsn1InputStream(
16 | Stream inputStream)
17 | : base(inputStream)
18 | {
19 | }
20 |
21 | internal override DerSequence CreateDerSequence(
22 | DefiniteLengthInputStream dIn)
23 | {
24 | return new LazyDerSequence(dIn.ToArray());
25 | }
26 |
27 | internal override DerSet CreateDerSet(
28 | DefiniteLengthInputStream dIn)
29 | {
30 | return new LazyDerSet(dIn.ToArray());
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/LimitedInputStream.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 |
3 | using Org.BouncyCastle.Utilities.IO;
4 |
5 | namespace Org.BouncyCastle.Asn1
6 | {
7 | internal abstract class LimitedInputStream
8 | : BaseInputStream
9 | {
10 | protected readonly Stream _in;
11 | private int _limit;
12 |
13 | internal LimitedInputStream(
14 | Stream inStream,
15 | int limit)
16 | {
17 | this._in = inStream;
18 | this._limit = limit;
19 | }
20 |
21 | internal virtual int GetRemaining()
22 | {
23 | // TODO: maybe one day this can become more accurate
24 | return _limit;
25 | }
26 |
27 | protected virtual void SetParentEofDetect(bool on)
28 | {
29 | if (_in is IndefiniteLengthInputStream)
30 | {
31 | ((IndefiniteLengthInputStream)_in).SetEofOn00(on);
32 | }
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/cmp/PKIConfirmContent.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Asn1.Cmp
4 | {
5 | public class PkiConfirmContent
6 | : Asn1Encodable
7 | {
8 | public static PkiConfirmContent GetInstance(object obj)
9 | {
10 | if (obj is PkiConfirmContent)
11 | return (PkiConfirmContent)obj;
12 |
13 | if (obj is Asn1Null)
14 | return new PkiConfirmContent();
15 |
16 | throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj");
17 | }
18 |
19 | public PkiConfirmContent()
20 | {
21 | }
22 |
23 | /**
24 | *
25 | * PkiConfirmContent ::= NULL
26 | *
27 | * @return a basic ASN.1 object representation.
28 | */
29 | public override Asn1Object ToAsn1Object()
30 | {
31 | return DerNull.Instance;
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/cms/Attributes.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Asn1.Cms
4 | {
5 | public class Attributes
6 | : Asn1Encodable
7 | {
8 | private readonly Asn1Set attributes;
9 |
10 | private Attributes(Asn1Set attributes)
11 | {
12 | this.attributes = attributes;
13 | }
14 |
15 | public Attributes(Asn1EncodableVector v)
16 | {
17 | attributes = new BerSet(v);
18 | }
19 |
20 | public static Attributes GetInstance(object obj)
21 | {
22 | if (obj is Attributes)
23 | return (Attributes)obj;
24 |
25 | if (obj != null)
26 | return new Attributes(Asn1Set.GetInstance(obj));
27 |
28 | return null;
29 | }
30 |
31 | /**
32 | *
33 | * Attributes ::=
34 | * SET SIZE(1..MAX) OF Attribute -- according to RFC 5652
35 | *
36 | * @return
37 | */
38 | public override Asn1Object ToAsn1Object()
39 | {
40 | return attributes;
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/cms/CMSAttributes.cs:
--------------------------------------------------------------------------------
1 | using Org.BouncyCastle.Asn1;
2 | using Org.BouncyCastle.Asn1.Pkcs;
3 |
4 | namespace Org.BouncyCastle.Asn1.Cms
5 | {
6 | public abstract class CmsAttributes
7 | {
8 | public static readonly DerObjectIdentifier ContentType = PkcsObjectIdentifiers.Pkcs9AtContentType;
9 | public static readonly DerObjectIdentifier MessageDigest = PkcsObjectIdentifiers.Pkcs9AtMessageDigest;
10 | public static readonly DerObjectIdentifier SigningTime = PkcsObjectIdentifiers.Pkcs9AtSigningTime;
11 | public static readonly DerObjectIdentifier CounterSignature = PkcsObjectIdentifiers.Pkcs9AtCounterSignature;
12 | public static readonly DerObjectIdentifier ContentHint = PkcsObjectIdentifiers.IdAAContentHint;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/cms/ContentInfoParser.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Asn1.Cms
4 | {
5 | /**
6 | * Produce an object suitable for an Asn1OutputStream.
7 | *
8 | * ContentInfo ::= SEQUENCE {
9 | * contentType ContentType,
10 | * content
11 | * [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL }
12 | *
13 | */
14 | public class ContentInfoParser
15 | {
16 | private DerObjectIdentifier contentType;
17 | private Asn1TaggedObjectParser content;
18 |
19 | public ContentInfoParser(
20 | Asn1SequenceParser seq)
21 | {
22 | contentType = (DerObjectIdentifier)seq.ReadObject();
23 | content = (Asn1TaggedObjectParser)seq.ReadObject();
24 | }
25 |
26 | public DerObjectIdentifier ContentType
27 | {
28 | get { return contentType; }
29 | }
30 |
31 | public IAsn1Convertible GetContent(
32 | int tag)
33 | {
34 | if (content == null)
35 | return null;
36 |
37 | return content.GetObjectParser(tag, true);
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/crmf/CrmfObjectIdentifiers.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Org.BouncyCastle.Asn1.Pkcs;
4 |
5 | namespace Org.BouncyCastle.Asn1.Crmf
6 | {
7 | public abstract class CrmfObjectIdentifiers
8 | {
9 | public static readonly DerObjectIdentifier id_pkix = new DerObjectIdentifier("1.3.6.1.5.5.7");
10 |
11 | // arc for Internet X.509 PKI protocols and their components
12 |
13 | public static readonly DerObjectIdentifier id_pkip = id_pkix.Branch("5");
14 |
15 | public static readonly DerObjectIdentifier id_regCtrl = id_pkip.Branch("1");
16 | public static readonly DerObjectIdentifier id_regCtrl_regToken = id_regCtrl.Branch("1");
17 | public static readonly DerObjectIdentifier id_regCtrl_authenticator = id_regCtrl.Branch("2");
18 | public static readonly DerObjectIdentifier id_regCtrl_pkiPublicationInfo = id_regCtrl.Branch("3");
19 | public static readonly DerObjectIdentifier id_regCtrl_pkiArchiveOptions = id_regCtrl.Branch("4");
20 |
21 | public static readonly DerObjectIdentifier id_ct_encKeyWithID = new DerObjectIdentifier(PkcsObjectIdentifiers.IdCT + ".21");
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/crmf/SubsequentMessage.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Asn1.Crmf
4 | {
5 | public class SubsequentMessage
6 | : DerInteger
7 | {
8 | public static readonly SubsequentMessage encrCert = new SubsequentMessage(0);
9 | public static readonly SubsequentMessage challengeResp = new SubsequentMessage(1);
10 |
11 | private SubsequentMessage(int value)
12 | : base(value)
13 | {
14 | }
15 |
16 | public static SubsequentMessage ValueOf(int value)
17 | {
18 | if (value == 0)
19 | return encrCert;
20 |
21 | if (value == 1)
22 | return challengeResp;
23 |
24 | throw new ArgumentException("unknown value: " + value, "value");
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/esf/CommitmentTypeIdentifier.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Org.BouncyCastle.Asn1;
4 | using Org.BouncyCastle.Asn1.Pkcs;
5 |
6 | namespace Org.BouncyCastle.Asn1.Esf
7 | {
8 | public abstract class CommitmentTypeIdentifier
9 | {
10 | public static readonly DerObjectIdentifier ProofOfOrigin = PkcsObjectIdentifiers.IdCtiEtsProofOfOrigin;
11 | public static readonly DerObjectIdentifier ProofOfReceipt = PkcsObjectIdentifiers.IdCtiEtsProofOfReceipt;
12 | public static readonly DerObjectIdentifier ProofOfDelivery = PkcsObjectIdentifiers.IdCtiEtsProofOfDelivery;
13 | public static readonly DerObjectIdentifier ProofOfSender = PkcsObjectIdentifiers.IdCtiEtsProofOfSender;
14 | public static readonly DerObjectIdentifier ProofOfApproval = PkcsObjectIdentifiers.IdCtiEtsProofOfApproval;
15 | public static readonly DerObjectIdentifier ProofOfCreation = PkcsObjectIdentifiers.IdCtiEtsProofOfCreation;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/iana/IANAObjectIdentifiers.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Asn1.Iana
2 | {
3 | public abstract class IanaObjectIdentifiers
4 | {
5 | // id-SHA1 OBJECT IDENTIFIER ::=
6 | // {iso(1) identified-organization(3) dod(6) internet(1) security(5) mechanisms(5) ipsec(8) isakmpOakley(1)}
7 | //
8 |
9 | public static readonly DerObjectIdentifier IsakmpOakley = new DerObjectIdentifier("1.3.6.1.5.5.8.1");
10 |
11 | public static readonly DerObjectIdentifier HmacMD5 = new DerObjectIdentifier(IsakmpOakley + ".1");
12 | public static readonly DerObjectIdentifier HmacSha1 = new DerObjectIdentifier(IsakmpOakley + ".2");
13 |
14 | public static readonly DerObjectIdentifier HmacTiger = new DerObjectIdentifier(IsakmpOakley + ".3");
15 |
16 | public static readonly DerObjectIdentifier HmacRipeMD160 = new DerObjectIdentifier(IsakmpOakley + ".4");
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/isismtt/x509/AdmissionSyntax.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/retroplasma/binsync/0492f1c82f93740f76119a4a4cbed4cc2ffa958c/src/Binsync.Dependencies/BountyCastle/asn1/isismtt/x509/AdmissionSyntax.cs
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/kisa/KISAObjectIdentifiers.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Asn1.Kisa
2 | {
3 | public abstract class KisaObjectIdentifiers
4 | {
5 | public static readonly DerObjectIdentifier IdSeedCbc = new DerObjectIdentifier("1.2.410.200004.1.4");
6 | public static readonly DerObjectIdentifier IdNpkiAppCmsSeedWrap = new DerObjectIdentifier("1.2.410.200004.7.1.1.1");
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/microsoft/MicrosoftObjectIdentifiers.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Asn1.Microsoft
4 | {
5 | public abstract class MicrosoftObjectIdentifiers
6 | {
7 | //
8 | // Microsoft
9 | // iso(1) identified-organization(3) dod(6) internet(1) private(4) enterprise(1) Microsoft(311)
10 | //
11 | public static readonly DerObjectIdentifier Microsoft = new DerObjectIdentifier("1.3.6.1.4.1.311");
12 | public static readonly DerObjectIdentifier MicrosoftCertTemplateV1 = new DerObjectIdentifier(Microsoft + ".20.2");
13 | public static readonly DerObjectIdentifier MicrosoftCAVersion = new DerObjectIdentifier(Microsoft + ".21.1");
14 | public static readonly DerObjectIdentifier MicrosoftPrevCACertHash = new DerObjectIdentifier(Microsoft + ".21.2");
15 | public static readonly DerObjectIdentifier MicrosoftCertTemplateV2 = new DerObjectIdentifier(Microsoft + ".21.7");
16 | public static readonly DerObjectIdentifier MicrosoftAppPolicies = new DerObjectIdentifier(Microsoft + ".21.10");
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/misc/NetscapeRevocationURL.cs:
--------------------------------------------------------------------------------
1 | using Org.BouncyCastle.Asn1;
2 |
3 | namespace Org.BouncyCastle.Asn1.Misc
4 | {
5 | public class NetscapeRevocationUrl
6 | : DerIA5String
7 | {
8 | public NetscapeRevocationUrl(DerIA5String str)
9 | : base(str.GetString())
10 | {
11 | }
12 |
13 | public override string ToString()
14 | {
15 | return "NetscapeRevocationUrl: " + this.GetString();
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/misc/VerisignCzagExtension.cs:
--------------------------------------------------------------------------------
1 | using Org.BouncyCastle.Asn1;
2 |
3 | namespace Org.BouncyCastle.Asn1.Misc
4 | {
5 | public class VerisignCzagExtension
6 | : DerIA5String
7 | {
8 | public VerisignCzagExtension(DerIA5String str)
9 | : base(str.GetString())
10 | {
11 | }
12 |
13 | public override string ToString()
14 | {
15 | return "VerisignCzagExtension: " + this.GetString();
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/ntt/NTTObjectIdentifiers.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Asn1.Ntt
2 | {
3 | /// From RFC 3657
4 | public abstract class NttObjectIdentifiers
5 | {
6 | public static readonly DerObjectIdentifier IdCamellia128Cbc = new DerObjectIdentifier("1.2.392.200011.61.1.1.1.2");
7 | public static readonly DerObjectIdentifier IdCamellia192Cbc = new DerObjectIdentifier("1.2.392.200011.61.1.1.1.3");
8 | public static readonly DerObjectIdentifier IdCamellia256Cbc = new DerObjectIdentifier("1.2.392.200011.61.1.1.1.4");
9 |
10 | public static readonly DerObjectIdentifier IdCamellia128Wrap = new DerObjectIdentifier("1.2.392.200011.61.1.1.3.2");
11 | public static readonly DerObjectIdentifier IdCamellia192Wrap = new DerObjectIdentifier("1.2.392.200011.61.1.1.3.3");
12 | public static readonly DerObjectIdentifier IdCamellia256Wrap = new DerObjectIdentifier("1.2.392.200011.61.1.1.3.4");
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/ocsp/OCSPObjectIdentifiers.cs:
--------------------------------------------------------------------------------
1 | using Org.BouncyCastle.Asn1;
2 |
3 | namespace Org.BouncyCastle.Asn1.Ocsp
4 | {
5 | public abstract class OcspObjectIdentifiers
6 | {
7 | internal const string PkixOcspId = "1.3.6.1.5.5.7.48.1";
8 |
9 | public static readonly DerObjectIdentifier PkixOcsp = new DerObjectIdentifier(PkixOcspId);
10 | public static readonly DerObjectIdentifier PkixOcspBasic = new DerObjectIdentifier(PkixOcspId + ".1");
11 |
12 | //
13 | // extensions
14 | //
15 | public static readonly DerObjectIdentifier PkixOcspNonce = new DerObjectIdentifier(PkixOcsp + ".2");
16 | public static readonly DerObjectIdentifier PkixOcspCrl = new DerObjectIdentifier(PkixOcsp + ".3");
17 |
18 | public static readonly DerObjectIdentifier PkixOcspResponse = new DerObjectIdentifier(PkixOcsp + ".4");
19 | public static readonly DerObjectIdentifier PkixOcspNocheck = new DerObjectIdentifier(PkixOcsp + ".5");
20 | public static readonly DerObjectIdentifier PkixOcspArchiveCutoff = new DerObjectIdentifier(PkixOcsp + ".6");
21 | public static readonly DerObjectIdentifier PkixOcspServiceLocator = new DerObjectIdentifier(PkixOcsp + ".7");
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/oiw/ElGamalParameter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 |
4 | using Org.BouncyCastle.Asn1;
5 | using Org.BouncyCastle.Math;
6 |
7 | namespace Org.BouncyCastle.Asn1.Oiw
8 | {
9 | public class ElGamalParameter
10 | : Asn1Encodable
11 | {
12 | internal DerInteger p, g;
13 |
14 | public ElGamalParameter(
15 | BigInteger p,
16 | BigInteger g)
17 | {
18 | this.p = new DerInteger(p);
19 | this.g = new DerInteger(g);
20 | }
21 |
22 | public ElGamalParameter(
23 | Asn1Sequence seq)
24 | {
25 | if (seq.Count != 2)
26 | throw new ArgumentException("Wrong number of elements in sequence", "seq");
27 |
28 | p = DerInteger.GetInstance(seq[0]);
29 | g = DerInteger.GetInstance(seq[1]);
30 | }
31 |
32 | public BigInteger P
33 | {
34 | get { return p.PositiveValue; }
35 | }
36 |
37 | public BigInteger G
38 | {
39 | get { return g.PositiveValue; }
40 | }
41 |
42 | public override Asn1Object ToAsn1Object()
43 | {
44 | return new DerSequence(p, g);
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/pkcs/AuthenticatedSafe.cs:
--------------------------------------------------------------------------------
1 | using Org.BouncyCastle.Asn1;
2 |
3 | namespace Org.BouncyCastle.Asn1.Pkcs
4 | {
5 | public class AuthenticatedSafe
6 | : Asn1Encodable
7 | {
8 | private readonly ContentInfo[] info;
9 |
10 | public AuthenticatedSafe(
11 | Asn1Sequence seq)
12 | {
13 | info = new ContentInfo[seq.Count];
14 |
15 | for (int i = 0; i != info.Length; i++)
16 | {
17 | info[i] = ContentInfo.GetInstance(seq[i]);
18 | }
19 | }
20 |
21 | public AuthenticatedSafe(
22 | ContentInfo[] info)
23 | {
24 | this.info = (ContentInfo[]) info.Clone();
25 | }
26 |
27 | public ContentInfo[] GetContentInfo()
28 | {
29 | return (ContentInfo[]) info.Clone();
30 | }
31 |
32 | public override Asn1Object ToAsn1Object()
33 | {
34 | return new BerSequence(info);
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/pkcs/KeyDerivationFunc.cs:
--------------------------------------------------------------------------------
1 | using Org.BouncyCastle.Asn1;
2 | using Org.BouncyCastle.Asn1.X509;
3 |
4 | namespace Org.BouncyCastle.Asn1.Pkcs
5 | {
6 | public class KeyDerivationFunc
7 | : AlgorithmIdentifier
8 | {
9 | internal KeyDerivationFunc(Asn1Sequence seq)
10 | : base(seq)
11 | {
12 | }
13 |
14 | public KeyDerivationFunc(
15 | DerObjectIdentifier id,
16 | Asn1Encodable parameters)
17 | : base(id, parameters)
18 | {
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/smime/SMIMEAttributes.cs:
--------------------------------------------------------------------------------
1 | using Org.BouncyCastle.Asn1;
2 | using Org.BouncyCastle.Asn1.Pkcs;
3 |
4 | namespace Org.BouncyCastle.Asn1.Smime
5 | {
6 | public abstract class SmimeAttributes
7 | {
8 | public static readonly DerObjectIdentifier SmimeCapabilities = PkcsObjectIdentifiers.Pkcs9AtSmimeCapabilities;
9 | public static readonly DerObjectIdentifier EncrypKeyPref = PkcsObjectIdentifiers.IdAAEncrypKeyPref;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/smime/SMIMECapabilitiesAttribute.cs:
--------------------------------------------------------------------------------
1 | using Org.BouncyCastle.Asn1;
2 | using Org.BouncyCastle.Asn1.X509;
3 |
4 | namespace Org.BouncyCastle.Asn1.Smime
5 | {
6 | public class SmimeCapabilitiesAttribute
7 | : AttributeX509
8 | {
9 | public SmimeCapabilitiesAttribute(
10 | SmimeCapabilityVector capabilities)
11 | : base(SmimeAttributes.SmimeCapabilities,
12 | new DerSet(new DerSequence(capabilities.ToAsn1EncodableVector())))
13 | {
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/smime/SMIMECapabilityVector.cs:
--------------------------------------------------------------------------------
1 | using Org.BouncyCastle.Asn1;
2 |
3 | namespace Org.BouncyCastle.Asn1.Smime
4 | {
5 | /**
6 | * Handler for creating a vector S/MIME Capabilities
7 | */
8 | public class SmimeCapabilityVector
9 | {
10 | private readonly Asn1EncodableVector capabilities = new Asn1EncodableVector();
11 |
12 | public void AddCapability(
13 | DerObjectIdentifier capability)
14 | {
15 | capabilities.Add(new DerSequence(capability));
16 | }
17 |
18 | public void AddCapability(
19 | DerObjectIdentifier capability,
20 | int value)
21 | {
22 | capabilities.Add(new DerSequence(capability, new DerInteger(value)));
23 | }
24 |
25 | public void AddCapability(
26 | DerObjectIdentifier capability,
27 | Asn1Encodable parameters)
28 | {
29 | capabilities.Add(new DerSequence(capability, parameters));
30 | }
31 |
32 | public Asn1EncodableVector ToAsn1EncodableVector()
33 | {
34 | return capabilities;
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/util/Dump.cs:
--------------------------------------------------------------------------------
1 | using Org.BouncyCastle.Asn1;
2 |
3 | using System;
4 | using System.IO;
5 |
6 | namespace Org.BouncyCastle.Asn1.Utilities
7 | {
8 | public sealed class Dump
9 | {
10 | private Dump()
11 | {
12 | }
13 |
14 | /*public static void Main(string[] args)
15 | {
16 | FileStream fIn = File.OpenRead(args[0]);
17 | Asn1InputStream bIn = new Asn1InputStream(fIn);
18 |
19 | Asn1Object obj;
20 | while ((obj = bIn.ReadObject()) != null)
21 | {
22 | Console.WriteLine(Asn1Dump.DumpAsString(obj));
23 | }
24 |
25 | bIn.Close();
26 | }*/
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/x509/CRLNumber.cs:
--------------------------------------------------------------------------------
1 | using Org.BouncyCastle.Math;
2 |
3 | namespace Org.BouncyCastle.Asn1.X509
4 | {
5 | /**
6 | * The CRLNumber object.
7 | *
8 | * CRLNumber::= Integer(0..MAX)
9 | *
10 | */
11 | public class CrlNumber
12 | : DerInteger
13 | {
14 | public CrlNumber(
15 | BigInteger number)
16 | : base(number)
17 | {
18 | }
19 |
20 | public BigInteger Number
21 | {
22 | get { return PositiveValue; }
23 | }
24 |
25 | public override string ToString()
26 | {
27 | return "CRLNumber: " + Number;
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/x509/CertPolicyId.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Asn1.X509
2 | {
3 | /**
4 | * CertPolicyId, used in the CertificatePolicies and PolicyMappings
5 | * X509V3 Extensions.
6 | *
7 | *
8 | * CertPolicyId ::= OBJECT IDENTIFIER
9 | *
10 | */
11 | public class CertPolicyID
12 | : DerObjectIdentifier
13 | {
14 | public CertPolicyID(
15 | string id)
16 | : base(id)
17 | {
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/x509/PolicyQualifierId.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Asn1.X509
2 | {
3 | /**
4 | * PolicyQualifierId, used in the CertificatePolicies
5 | * X509V3 extension.
6 | *
7 | *
8 | * id-qt OBJECT IDENTIFIER ::= { id-pkix 2 }
9 | * id-qt-cps OBJECT IDENTIFIER ::= { id-qt 1 }
10 | * id-qt-unotice OBJECT IDENTIFIER ::= { id-qt 2 }
11 | * PolicyQualifierId ::=
12 | * OBJECT IDENTIFIER ( id-qt-cps | id-qt-unotice )
13 | *
14 | */
15 | public sealed class PolicyQualifierID : DerObjectIdentifier
16 | {
17 | private const string IdQt = "1.3.6.1.5.5.7.2";
18 |
19 | private PolicyQualifierID(
20 | string id)
21 | : base(id)
22 | {
23 | }
24 |
25 | public static readonly PolicyQualifierID IdQtCps = new PolicyQualifierID(IdQt + ".1");
26 | public static readonly PolicyQualifierID IdQtUnotice = new PolicyQualifierID(IdQt + ".2");
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/x509/X509Attributes.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Asn1.X509
4 | {
5 | public class X509Attributes
6 | {
7 | public static readonly DerObjectIdentifier RoleSyntax = new DerObjectIdentifier("2.5.4.72");
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/x509/qualified/ETSIQCObjectIdentifiers.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Org.BouncyCastle.Asn1;
4 |
5 | namespace Org.BouncyCastle.Asn1.X509.Qualified
6 | {
7 | public abstract class EtsiQCObjectIdentifiers
8 | {
9 | //
10 | // base id
11 | //
12 | public static readonly DerObjectIdentifier IdEtsiQcs = new DerObjectIdentifier("0.4.0.1862.1");
13 |
14 | public static readonly DerObjectIdentifier IdEtsiQcsQcCompliance = new DerObjectIdentifier(IdEtsiQcs+".1");
15 | public static readonly DerObjectIdentifier IdEtsiQcsLimitValue = new DerObjectIdentifier(IdEtsiQcs+".2");
16 | public static readonly DerObjectIdentifier IdEtsiQcsRetentionPeriod = new DerObjectIdentifier(IdEtsiQcs+".3");
17 | public static readonly DerObjectIdentifier IdEtsiQcsQcSscd = new DerObjectIdentifier(IdEtsiQcs+".4");
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/x509/qualified/RFC3739QCObjectIdentifiers.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Org.BouncyCastle.Asn1;
4 |
5 | namespace Org.BouncyCastle.Asn1.X509.Qualified
6 | {
7 | public sealed class Rfc3739QCObjectIdentifiers
8 | {
9 | private Rfc3739QCObjectIdentifiers()
10 | {
11 | }
12 |
13 | //
14 | // base id
15 | //
16 | public static readonly DerObjectIdentifier IdQcs = new DerObjectIdentifier("1.3.6.1.5.5.7.11");
17 |
18 | public static readonly DerObjectIdentifier IdQcsPkixQCSyntaxV1 = new DerObjectIdentifier(IdQcs+".1");
19 | public static readonly DerObjectIdentifier IdQcsPkixQCSyntaxV2 = new DerObjectIdentifier(IdQcs+".2");
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/x9/DHPublicKey.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Asn1.X9
4 | {
5 | public class DHPublicKey
6 | : Asn1Encodable
7 | {
8 | private readonly DerInteger y;
9 |
10 | public static DHPublicKey GetInstance(Asn1TaggedObject obj, bool isExplicit)
11 | {
12 | return GetInstance(DerInteger.GetInstance(obj, isExplicit));
13 | }
14 |
15 | public static DHPublicKey GetInstance(object obj)
16 | {
17 | if (obj == null || obj is DHPublicKey)
18 | return (DHPublicKey)obj;
19 |
20 | if (obj is DerInteger)
21 | return new DHPublicKey((DerInteger)obj);
22 |
23 | throw new ArgumentException("Invalid DHPublicKey: " + obj.GetType().FullName, "obj");
24 | }
25 |
26 | public DHPublicKey(DerInteger y)
27 | {
28 | if (y == null)
29 | throw new ArgumentNullException("y");
30 |
31 | this.y = y;
32 | }
33 |
34 | public DerInteger Y
35 | {
36 | get { return this.y; }
37 | }
38 |
39 | public override Asn1Object ToAsn1Object()
40 | {
41 | return this.y;
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/x9/X9ECParametersHolder.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Asn1.X9
2 | {
3 | public abstract class X9ECParametersHolder
4 | {
5 | private X9ECParameters parameters;
6 |
7 | public X9ECParameters Parameters
8 | {
9 | get
10 | {
11 | if (parameters == null)
12 | {
13 | parameters = CreateParameters();
14 | }
15 |
16 | return parameters;
17 | }
18 | }
19 |
20 | protected abstract X9ECParameters CreateParameters();
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/x9/X9ECPoint.cs:
--------------------------------------------------------------------------------
1 | using Org.BouncyCastle.Math.EC;
2 |
3 | namespace Org.BouncyCastle.Asn1.X9
4 | {
5 | /**
6 | * class for describing an ECPoint as a Der object.
7 | */
8 | public class X9ECPoint
9 | : Asn1Encodable
10 | {
11 | private readonly ECPoint p;
12 |
13 | public X9ECPoint(
14 | ECPoint p)
15 | {
16 | this.p = p;
17 | }
18 |
19 | public X9ECPoint(
20 | ECCurve c,
21 | Asn1OctetString s)
22 | {
23 | this.p = c.DecodePoint(s.GetOctets());
24 | }
25 |
26 | public ECPoint Point
27 | {
28 | get { return p; }
29 | }
30 |
31 | /**
32 | * Produce an object suitable for an Asn1OutputStream.
33 | *
34 | * ECPoint ::= OCTET STRING
35 | *
36 | *
37 | * Octet string produced using ECPoint.GetEncoded().
38 | */
39 | public override Asn1Object ToAsn1Object()
40 | {
41 | return new DerOctetString(p.GetEncoded());
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/asn1/x9/X9IntegerConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Org.BouncyCastle.Math;
4 | using Org.BouncyCastle.Math.EC;
5 |
6 | namespace Org.BouncyCastle.Asn1.X9
7 | {
8 | public sealed class X9IntegerConverter
9 | {
10 | private X9IntegerConverter()
11 | {
12 | }
13 |
14 | public static int GetByteLength(
15 | ECFieldElement fe)
16 | {
17 | return (fe.FieldSize + 7) / 8;
18 | }
19 |
20 | public static int GetByteLength(
21 | ECCurve c)
22 | {
23 | return (c.FieldSize + 7) / 8;
24 | }
25 |
26 | public static byte[] IntegerToBytes(
27 | BigInteger s,
28 | int qLength)
29 | {
30 | byte[] bytes = s.ToByteArrayUnsigned();
31 |
32 | if (qLength < bytes.Length)
33 | {
34 | byte[] tmp = new byte[qLength];
35 | Array.Copy(bytes, bytes.Length - tmp.Length, tmp, 0, tmp.Length);
36 | return tmp;
37 | }
38 | else if (qLength > bytes.Length)
39 | {
40 | byte[] tmp = new byte[qLength];
41 | Array.Copy(bytes, 0, tmp, tmp.Length - bytes.Length, bytes.Length);
42 | return tmp;
43 | }
44 |
45 | return bytes;
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/bcpg/BcpgObject.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | namespace Org.BouncyCastle.Bcpg
5 | {
6 | /// Base class for a PGP object.
7 | public abstract class BcpgObject
8 | {
9 | public virtual byte[] GetEncoded()
10 | {
11 | MemoryStream bOut = new MemoryStream();
12 | BcpgOutputStream pOut = new BcpgOutputStream(bOut);
13 |
14 | pOut.WriteObject(this);
15 |
16 | return bOut.ToArray();
17 | }
18 |
19 | public abstract void Encode(BcpgOutputStream bcpgOut);
20 | }
21 | }
22 |
23 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/bcpg/CompressedDataPacket.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 |
3 | namespace Org.BouncyCastle.Bcpg
4 | {
5 | /// Generic compressed data object.
6 | public class CompressedDataPacket
7 | : InputStreamPacket
8 | {
9 | private readonly CompressionAlgorithmTag algorithm;
10 |
11 | internal CompressedDataPacket(
12 | BcpgInputStream bcpgIn)
13 | : base(bcpgIn)
14 | {
15 | this.algorithm = (CompressionAlgorithmTag) bcpgIn.ReadByte();
16 | }
17 |
18 | /// The algorithm tag value.
19 | public CompressionAlgorithmTag Algorithm
20 | {
21 | get { return algorithm; }
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/bcpg/CompressionAlgorithmTags.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Bcpg
2 | {
3 | /// Basic tags for compression algorithms.
4 | public enum CompressionAlgorithmTag
5 | {
6 | Uncompressed = 0, // Uncompressed
7 | Zip = 1, // ZIP (RFC 1951)
8 | ZLib = 2, // ZLIB (RFC 1950)
9 | BZip2 = 3, // BZ2
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/bcpg/ContainedPacket.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | namespace Org.BouncyCastle.Bcpg
5 | {
6 | /// Basic type for a PGP packet.
7 | public abstract class ContainedPacket
8 | : Packet
9 | {
10 | public byte[] GetEncoded()
11 | {
12 | MemoryStream bOut = new MemoryStream();
13 | BcpgOutputStream pOut = new BcpgOutputStream(bOut);
14 |
15 | pOut.WritePacket(this);
16 |
17 | return bOut.ToArray();
18 | }
19 |
20 | public abstract void Encode(BcpgOutputStream bcpgOut);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/bcpg/Crc24.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Bcpg
4 | {
5 | public class Crc24
6 | {
7 | private const int Crc24Init = 0x0b704ce;
8 | private const int Crc24Poly = 0x1864cfb;
9 |
10 | private int crc = Crc24Init;
11 |
12 | public Crc24()
13 | {
14 | }
15 |
16 | public void Update(
17 | int b)
18 | {
19 | crc ^= b << 16;
20 | for (int i = 0; i < 8; i++)
21 | {
22 | crc <<= 1;
23 | if ((crc & 0x1000000) != 0)
24 | {
25 | crc ^= Crc24Poly;
26 | }
27 | }
28 | }
29 |
30 | [Obsolete("Use 'Value' property instead")]
31 | public int GetValue()
32 | {
33 | return crc;
34 | }
35 |
36 | public int Value
37 | {
38 | get { return crc; }
39 | }
40 |
41 | public void Reset()
42 | {
43 | crc = Crc24Init;
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/bcpg/ExperimentalPacket.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | namespace Org.BouncyCastle.Bcpg
5 | {
6 | /// Basic packet for an experimental packet.
7 | public class ExperimentalPacket
8 | : ContainedPacket //, PublicKeyAlgorithmTag
9 | {
10 | private readonly PacketTag tag;
11 | private readonly byte[] contents;
12 |
13 | internal ExperimentalPacket(
14 | PacketTag tag,
15 | BcpgInputStream bcpgIn)
16 | {
17 | this.tag = tag;
18 |
19 | this.contents = bcpgIn.ReadAll();
20 | }
21 |
22 | public PacketTag Tag
23 | {
24 | get { return tag; }
25 | }
26 |
27 | public byte[] GetContents()
28 | {
29 | return (byte[]) contents.Clone();
30 | }
31 |
32 | public override void Encode(
33 | BcpgOutputStream bcpgOut)
34 | {
35 | bcpgOut.WritePacket(tag, contents, true);
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/bcpg/HashAlgorithmTags.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Bcpg
2 | {
3 | /// Basic tags for hash algorithms.
4 | public enum HashAlgorithmTag
5 | {
6 | MD5 = 1, // MD5
7 | Sha1 = 2, // SHA-1
8 | RipeMD160 = 3, // RIPE-MD/160
9 | DoubleSha = 4, // Reserved for double-width SHA (experimental)
10 | MD2 = 5, // MD2
11 | Tiger192 = 6, // Reserved for TIGER/192
12 | Haval5pass160 = 7, // Reserved for HAVAL (5 pass, 160-bit)
13 |
14 | Sha256 = 8, // SHA-256
15 | Sha384 = 9, // SHA-384
16 | Sha512 = 10, // SHA-512
17 | Sha224 = 11, // SHA-224
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/bcpg/IBcpgKey.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Bcpg
4 | {
5 | /// Base interface for a PGP key.
6 | public interface IBcpgKey
7 | {
8 | ///
9 | /// The base format for this key - in the case of the symmetric keys it will generally
10 | /// be raw indicating that the key is just a straight byte representation, for an asymmetric
11 | /// key the format will be PGP, indicating the key is a string of MPIs encoded in PGP format.
12 | ///
13 | /// "RAW" or "PGP".
14 | string Format { get; }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/bcpg/InputStreamPacket.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Bcpg
2 | {
3 | public class InputStreamPacket
4 | : Packet
5 | {
6 | private readonly BcpgInputStream bcpgIn;
7 |
8 | public InputStreamPacket(
9 | BcpgInputStream bcpgIn)
10 | {
11 | this.bcpgIn = bcpgIn;
12 | }
13 |
14 | /// Note: you can only read from this once...
15 | public BcpgInputStream GetInputStream()
16 | {
17 | return bcpgIn;
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/bcpg/MarkerPacket.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 |
3 | namespace Org.BouncyCastle.Bcpg
4 | {
5 | /// Basic type for a marker packet.
6 | public class MarkerPacket
7 | : ContainedPacket
8 | {
9 | // "PGP"
10 | byte[] marker = { (byte)0x50, (byte)0x47, (byte)0x50 };
11 |
12 | public MarkerPacket(
13 | BcpgInputStream bcpgIn)
14 | {
15 | bcpgIn.ReadFully(marker);
16 | }
17 |
18 | public override void Encode(
19 | BcpgOutputStream bcpgOut)
20 | {
21 | bcpgOut.WritePacket(PacketTag.Marker, marker, true);
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/bcpg/ModDetectionCodePacket.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | namespace Org.BouncyCastle.Bcpg
5 | {
6 | /// Basic packet for a modification detection code packet.
7 | public class ModDetectionCodePacket
8 | : ContainedPacket
9 | {
10 | private readonly byte[] digest;
11 |
12 | internal ModDetectionCodePacket(
13 | BcpgInputStream bcpgIn)
14 | {
15 | if (bcpgIn == null)
16 | throw new ArgumentNullException("bcpgIn");
17 |
18 | this.digest = new byte[20];
19 | bcpgIn.ReadFully(this.digest);
20 | }
21 |
22 | public ModDetectionCodePacket(
23 | byte[] digest)
24 | {
25 | if (digest == null)
26 | throw new ArgumentNullException("digest");
27 |
28 | this.digest = (byte[]) digest.Clone();
29 | }
30 |
31 | public byte[] GetDigest()
32 | {
33 | return (byte[]) digest.Clone();
34 | }
35 |
36 | public override void Encode(
37 | BcpgOutputStream bcpgOut)
38 | {
39 | bcpgOut.WritePacket(PacketTag.ModificationDetectionCode, digest, false);
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/bcpg/OutputStreamPacket.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | namespace Org.BouncyCastle.Bcpg
5 | {
6 | public abstract class OutputStreamPacket
7 | {
8 | private readonly BcpgOutputStream bcpgOut;
9 |
10 | internal OutputStreamPacket(
11 | BcpgOutputStream bcpgOut)
12 | {
13 | if (bcpgOut == null)
14 | throw new ArgumentNullException("bcpgOut");
15 |
16 | this.bcpgOut = bcpgOut;
17 | }
18 |
19 | public abstract BcpgOutputStream Open();
20 |
21 | public abstract void Close();
22 | }
23 | }
24 |
25 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/bcpg/Packet.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Bcpg
2 | {
3 | public class Packet
4 | //: PacketTag
5 | {
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/bcpg/PublicKeyAlgorithmTags.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Bcpg
2 | {
3 | /// Public Key Algorithm tag numbers.
4 | public enum PublicKeyAlgorithmTag
5 | {
6 | RsaGeneral = 1, // RSA (Encrypt or Sign)
7 | RsaEncrypt = 2, // RSA Encrypt-Only
8 | RsaSign = 3, // RSA Sign-Only
9 | ElGamalEncrypt = 16, // Elgamal (Encrypt-Only), see [ELGAMAL]
10 | Dsa = 17, // DSA (Digital Signature Standard)
11 | EC = 18, // Reserved for Elliptic Curve
12 | ECDsa = 19, // Reserved for ECDSA
13 | ElGamalGeneral = 20, // Elgamal (Encrypt or Sign)
14 | DiffieHellman = 21, // Reserved for Diffie-Hellman (X9.42, as defined for IETF-S/MIME)
15 |
16 | Experimental_1 = 100,
17 | Experimental_2 = 101,
18 | Experimental_3 = 102,
19 | Experimental_4 = 103,
20 | Experimental_5 = 104,
21 | Experimental_6 = 105,
22 | Experimental_7 = 106,
23 | Experimental_8 = 107,
24 | Experimental_9 = 108,
25 | Experimental_10 = 109,
26 | Experimental_11 = 110,
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/bcpg/PublicSubkeyPacket.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | namespace Org.BouncyCastle.Bcpg
4 | {
5 | /// Basic packet for a PGP public subkey
6 | public class PublicSubkeyPacket
7 | : PublicKeyPacket
8 | {
9 | internal PublicSubkeyPacket(
10 | BcpgInputStream bcpgIn)
11 | : base(bcpgIn)
12 | {
13 | }
14 |
15 | /// Construct a version 4 public subkey packet.
16 | public PublicSubkeyPacket(
17 | PublicKeyAlgorithmTag algorithm,
18 | DateTime time,
19 | IBcpgKey key)
20 | : base(algorithm, time, key)
21 | {
22 | }
23 |
24 | public override void Encode(
25 | BcpgOutputStream bcpgOut)
26 | {
27 | bcpgOut.WritePacket(PacketTag.PublicSubkey, GetEncodedContents(), true);
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/bcpg/SymmetricEncDataPacket.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Bcpg
4 | {
5 | /// Basic type for a symmetric key encrypted packet.
6 | public class SymmetricEncDataPacket
7 | : InputStreamPacket
8 | {
9 | public SymmetricEncDataPacket(
10 | BcpgInputStream bcpgIn)
11 | : base(bcpgIn)
12 | {
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/bcpg/SymmetricEncIntegrityPacket.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | namespace Org.BouncyCastle.Bcpg
5 | {
6 | public class SymmetricEncIntegrityPacket
7 | : InputStreamPacket
8 | {
9 | internal readonly int version;
10 |
11 | internal SymmetricEncIntegrityPacket(
12 | BcpgInputStream bcpgIn)
13 | : base(bcpgIn)
14 | {
15 | version = bcpgIn.ReadByte();
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/bcpg/SymmetricKeyAlgorithmTags.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Bcpg
2 | {
3 | /**
4 | * Basic tags for symmetric key algorithms
5 | */
6 | public enum SymmetricKeyAlgorithmTag
7 | {
8 | Null = 0, // Plaintext or unencrypted data
9 | Idea = 1, // IDEA [IDEA]
10 | TripleDes = 2, // Triple-DES (DES-EDE, as per spec -168 bit key derived from 192)
11 | Cast5 = 3, // Cast5 (128 bit key, as per RFC 2144)
12 | Blowfish = 4, // Blowfish (128 bit key, 16 rounds) [Blowfish]
13 | Safer = 5, // Safer-SK128 (13 rounds) [Safer]
14 | Des = 6, // Reserved for DES/SK
15 | Aes128 = 7, // Reserved for AES with 128-bit key
16 | Aes192 = 8, // Reserved for AES with 192-bit key
17 | Aes256 = 9, // Reserved for AES with 256-bit key
18 | Twofish = 10 // Reserved for Twofish
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/bcpg/TrustPacket.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | namespace Org.BouncyCastle.Bcpg
5 | {
6 | /// Basic type for a trust packet.
7 | public class TrustPacket
8 | : ContainedPacket
9 | {
10 | private readonly byte[] levelAndTrustAmount;
11 |
12 | public TrustPacket(
13 | BcpgInputStream bcpgIn)
14 | {
15 | MemoryStream bOut = new MemoryStream();
16 |
17 | int ch;
18 | while ((ch = bcpgIn.ReadByte()) >= 0)
19 | {
20 | bOut.WriteByte((byte) ch);
21 | }
22 |
23 | levelAndTrustAmount = bOut.ToArray();
24 | }
25 |
26 | public TrustPacket(
27 | int trustCode)
28 | {
29 | this.levelAndTrustAmount = new byte[]{ (byte) trustCode };
30 | }
31 |
32 | public byte[] GetLevelAndTrustAmount()
33 | {
34 | return (byte[]) levelAndTrustAmount.Clone();
35 | }
36 |
37 | public override void Encode(
38 | BcpgOutputStream bcpgOut)
39 | {
40 | bcpgOut.WritePacket(PacketTag.Trust, levelAndTrustAmount, true);
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/bcpg/UserAttributeSubpacketTags.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Bcpg
2 | {
3 | /**
4 | * Basic PGP user attribute sub-packet tag types.
5 | */
6 | public enum UserAttributeSubpacketTag
7 | {
8 | ImageAttribute = 1
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/bcpg/UserIdPacket.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text;
3 |
4 | namespace Org.BouncyCastle.Bcpg
5 | {
6 | /**
7 | * Basic type for a user ID packet.
8 | */
9 | public class UserIdPacket
10 | : ContainedPacket
11 | {
12 | private readonly byte[] idData;
13 |
14 | public UserIdPacket(
15 | BcpgInputStream bcpgIn)
16 | {
17 | this.idData = bcpgIn.ReadAll();
18 | }
19 |
20 | public UserIdPacket(
21 | string id)
22 | {
23 | this.idData = Encoding.UTF8.GetBytes(id);
24 | }
25 |
26 | public string GetId()
27 | {
28 | return Encoding.UTF8.GetString(idData, 0, idData.Length);
29 | }
30 |
31 | public override void Encode(
32 | BcpgOutputStream bcpgOut)
33 | {
34 | bcpgOut.WritePacket(PacketTag.UserId, idData, true);
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/bcpg/sig/EmbeddedSignature.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Bcpg.Sig
4 | {
5 | /**
6 | * Packet embedded signature
7 | */
8 | public class EmbeddedSignature
9 | : SignatureSubpacket
10 | {
11 | public EmbeddedSignature(
12 | bool critical,
13 | byte[] data)
14 | : base(SignatureSubpacketTag.EmbeddedSignature, critical, data)
15 | {
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/bcpg/sig/TrustSignature.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Bcpg.Sig
4 | {
5 | /**
6 | * packet giving trust.
7 | */
8 | public class TrustSignature
9 | : SignatureSubpacket
10 | {
11 | private static byte[] IntToByteArray(
12 | int v1,
13 | int v2)
14 | {
15 | return new byte[]{ (byte)v1, (byte)v2 };
16 | }
17 |
18 | public TrustSignature(
19 | bool critical,
20 | byte[] data)
21 | : base(SignatureSubpacketTag.TrustSig, critical, data)
22 | {
23 | }
24 |
25 | public TrustSignature(
26 | bool critical,
27 | int depth,
28 | int trustAmount)
29 | : base(SignatureSubpacketTag.TrustSig, critical, IntToByteArray(depth, trustAmount))
30 | {
31 | }
32 |
33 | public int Depth
34 | {
35 | get { return data[0] & 0xff; }
36 | }
37 |
38 | public int TrustAmount
39 | {
40 | get { return data[1] & 0xff; }
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/cms/BaseDigestCalculator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Org.BouncyCastle.Utilities;
4 |
5 | namespace Org.BouncyCastle.Cms
6 | {
7 | internal class BaseDigestCalculator
8 | : IDigestCalculator
9 | {
10 | private readonly byte[] digest;
11 |
12 | internal BaseDigestCalculator(
13 | byte[] digest)
14 | {
15 | this.digest = digest;
16 | }
17 |
18 | public byte[] GetDigest()
19 | {
20 | return Arrays.Clone(digest);
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/cms/CMSAttributeTableGenerationException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Cms
4 | {
5 | public class CmsAttributeTableGenerationException
6 | : CmsException
7 | {
8 | public CmsAttributeTableGenerationException()
9 | {
10 | }
11 |
12 | public CmsAttributeTableGenerationException(
13 | string name)
14 | : base(name)
15 | {
16 | }
17 |
18 | public CmsAttributeTableGenerationException(
19 | string name,
20 | Exception e)
21 | : base(name, e)
22 | {
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/cms/CMSAttributeTableGenerator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 |
4 | using Org.BouncyCastle.Asn1.Cms;
5 |
6 | namespace Org.BouncyCastle.Cms
7 | {
8 | ///
9 | /// The 'Signature' parameter is only available when generating unsigned attributes.
10 | ///
11 | public enum CmsAttributeTableParameter
12 | {
13 | // const string ContentType = "contentType";
14 | // const string Digest = "digest";
15 | // const string Signature = "encryptedDigest";
16 | // const string DigestAlgorithmIdentifier = "digestAlgID";
17 |
18 | ContentType, Digest, Signature, DigestAlgorithmIdentifier
19 | }
20 |
21 | public interface CmsAttributeTableGenerator
22 | {
23 | AttributeTable GetAttributes(IDictionary parameters);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/cms/CMSAuthEnvelopedGenerator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Org.BouncyCastle.Asn1.Nist;
4 |
5 | namespace Org.BouncyCastle.Cms
6 | {
7 | internal class CmsAuthEnvelopedGenerator
8 | {
9 | public static readonly string Aes128Ccm = NistObjectIdentifiers.IdAes128Ccm.Id;
10 | public static readonly string Aes192Ccm = NistObjectIdentifiers.IdAes192Ccm.Id;
11 | public static readonly string Aes256Ccm = NistObjectIdentifiers.IdAes256Ccm.Id;
12 | public static readonly string Aes128Gcm = NistObjectIdentifiers.IdAes128Gcm.Id;
13 | public static readonly string Aes192Gcm = NistObjectIdentifiers.IdAes192Gcm.Id;
14 | public static readonly string Aes256Gcm = NistObjectIdentifiers.IdAes256Gcm.Id;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/cms/CMSAuthenticatedGenerator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | using Org.BouncyCastle.Asn1;
5 | using Org.BouncyCastle.Asn1.X509;
6 | using Org.BouncyCastle.Crypto;
7 | using Org.BouncyCastle.Crypto.Parameters;
8 | using Org.BouncyCastle.Security;
9 | using Org.BouncyCastle.Utilities.Date;
10 | using Org.BouncyCastle.Utilities.IO;
11 |
12 | namespace Org.BouncyCastle.Cms
13 | {
14 | public class CmsAuthenticatedGenerator
15 | : CmsEnvelopedGenerator
16 | {
17 | /**
18 | * base constructor
19 | */
20 | public CmsAuthenticatedGenerator()
21 | {
22 | }
23 |
24 | /**
25 | * constructor allowing specific source of randomness
26 | *
27 | * @param rand instance of SecureRandom to use
28 | */
29 | public CmsAuthenticatedGenerator(
30 | SecureRandom rand)
31 | : base(rand)
32 | {
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/cms/CMSContentInfoParser.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | using Org.BouncyCastle.Asn1;
5 | using Org.BouncyCastle.Asn1.Cms;
6 |
7 | namespace Org.BouncyCastle.Cms
8 | {
9 | public class CmsContentInfoParser
10 | {
11 | protected ContentInfoParser contentInfo;
12 | protected Stream data;
13 |
14 | protected CmsContentInfoParser(
15 | Stream data)
16 | {
17 | if (data == null)
18 | throw new ArgumentNullException("data");
19 |
20 | this.data = data;
21 |
22 | try
23 | {
24 | Asn1StreamParser inStream = new Asn1StreamParser(data);
25 |
26 | this.contentInfo = new ContentInfoParser((Asn1SequenceParser)inStream.ReadObject());
27 | }
28 | catch (IOException e)
29 | {
30 | throw new CmsException("IOException reading content.", e);
31 | }
32 | catch (InvalidCastException e)
33 | {
34 | throw new CmsException("Unexpected object reading content.", e);
35 | }
36 | }
37 |
38 | /**
39 | * Close the underlying data stream.
40 | * @throws IOException if the close fails.
41 | */
42 | public void Close()
43 | {
44 | this.data.Close();
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/cms/CMSException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Cms
4 | {
5 | public class CmsException
6 | : Exception
7 | {
8 | public CmsException()
9 | {
10 | }
11 |
12 | public CmsException(
13 | string msg)
14 | : base(msg)
15 | {
16 | }
17 |
18 | public CmsException(
19 | string msg,
20 | Exception e)
21 | : base(msg, e)
22 | {
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/cms/CMSProcessable.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | namespace Org.BouncyCastle.Cms
5 | {
6 | public interface CmsProcessable
7 | {
8 | ///
9 | /// Generic routine to copy out the data we want processed.
10 | ///
11 | ///
12 | /// This routine may be called multiple times.
13 | ///
14 | void Write(Stream outStream);
15 |
16 | object GetContent();
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/cms/CMSProcessableByteArray.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | namespace Org.BouncyCastle.Cms
5 | {
6 | /**
7 | * a holding class for a byte array of data to be processed.
8 | */
9 | public class CmsProcessableByteArray
10 | : CmsProcessable, CmsReadable
11 | {
12 | private readonly byte[] bytes;
13 |
14 | public CmsProcessableByteArray(
15 | byte[] bytes)
16 | {
17 | this.bytes = bytes;
18 | }
19 |
20 | public Stream GetInputStream()
21 | {
22 | return new MemoryStream(bytes, false);
23 | }
24 |
25 | public virtual void Write(Stream zOut)
26 | {
27 | zOut.Write(bytes, 0, bytes.Length);
28 | }
29 |
30 | /// A clone of the byte array
31 | public virtual object GetContent()
32 | {
33 | return bytes.Clone();
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/cms/CMSProcessableInputStream.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | using Org.BouncyCastle.Utilities.IO;
5 |
6 | namespace Org.BouncyCastle.Cms
7 | {
8 | public class CmsProcessableInputStream
9 | : CmsProcessable, CmsReadable
10 | {
11 | private Stream input;
12 | private bool used = false;
13 |
14 | public CmsProcessableInputStream(
15 | Stream input)
16 | {
17 | this.input = input;
18 | }
19 |
20 | public Stream GetInputStream()
21 | {
22 | CheckSingleUsage();
23 |
24 | return input;
25 | }
26 |
27 | public void Write(Stream output)
28 | {
29 | CheckSingleUsage();
30 |
31 | Streams.PipeAll(input, output);
32 | input.Close();
33 | }
34 |
35 | public object GetContent()
36 | {
37 | return GetInputStream();
38 | }
39 |
40 | private void CheckSingleUsage()
41 | {
42 | lock (this)
43 | {
44 | if (used)
45 | throw new InvalidOperationException("CmsProcessableInputStream can only be used once");
46 |
47 | used = true;
48 | }
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/cms/CMSReadable.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | namespace Org.BouncyCastle.Cms
5 | {
6 | internal interface CmsReadable
7 | {
8 | Stream GetInputStream();
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/cms/CMSSecureReadable.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Org.BouncyCastle.Asn1.X509;
4 | using Org.BouncyCastle.Crypto.Parameters;
5 |
6 | namespace Org.BouncyCastle.Cms
7 | {
8 | internal interface CmsSecureReadable
9 | {
10 | AlgorithmIdentifier Algorithm { get; }
11 | object CryptoObject { get; }
12 | CmsReadable GetReadable(KeyParameter key);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/cms/CMSStreamException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | namespace Org.BouncyCastle.Cms
5 | {
6 | public class CmsStreamException
7 | : IOException
8 | {
9 | public CmsStreamException()
10 | {
11 | }
12 |
13 | public CmsStreamException(
14 | string name)
15 | : base(name)
16 | {
17 | }
18 |
19 | public CmsStreamException(
20 | string name,
21 | Exception e)
22 | : base(name, e)
23 | {
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/cms/CounterSignatureDigestCalculator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Org.BouncyCastle.Crypto;
4 | using Org.BouncyCastle.Security;
5 |
6 | namespace Org.BouncyCastle.Cms
7 | {
8 | internal class CounterSignatureDigestCalculator
9 | : IDigestCalculator
10 | {
11 | private readonly string alg;
12 | private readonly byte[] data;
13 |
14 | internal CounterSignatureDigestCalculator(
15 | string alg,
16 | byte[] data)
17 | {
18 | this.alg = alg;
19 | this.data = data;
20 | }
21 |
22 | public byte[] GetDigest()
23 | {
24 | IDigest digest = CmsSignedHelper.Instance.GetDigestInstance(alg);
25 | return DigestUtilities.DoFinal(digest, data);
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/cms/DigOutputStream.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Org.BouncyCastle.Crypto;
4 | using Org.BouncyCastle.Utilities.IO;
5 |
6 | namespace Org.BouncyCastle.Cms
7 | {
8 | internal class DigOutputStream
9 | : BaseOutputStream
10 | {
11 | private readonly IDigest dig;
12 |
13 | internal DigOutputStream(IDigest dig)
14 | {
15 | this.dig = dig;
16 | }
17 |
18 | public override void WriteByte(byte b)
19 | {
20 | dig.Update(b);
21 | }
22 |
23 | public override void Write(byte[] b, int off, int len)
24 | {
25 | dig.BlockUpdate(b, off, len);
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/cms/IDigestCalculator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Cms
4 | {
5 | internal interface IDigestCalculator
6 | {
7 | byte[] GetDigest();
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/cms/MacOutputStream.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Org.BouncyCastle.Crypto;
4 | using Org.BouncyCastle.Utilities.IO;
5 |
6 | namespace Org.BouncyCastle.Cms
7 | {
8 | internal class MacOutputStream
9 | : BaseOutputStream
10 | {
11 | private readonly IMac mac;
12 |
13 | internal MacOutputStream(IMac mac)
14 | {
15 | this.mac = mac;
16 | }
17 |
18 | public override void Write(byte[] b, int off, int len)
19 | {
20 | mac.BlockUpdate(b, off, len);
21 | }
22 |
23 | public override void WriteByte(byte b)
24 | {
25 | mac.Update(b);
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/cms/NullOutputStream.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Org.BouncyCastle.Utilities.IO;
4 |
5 | namespace Org.BouncyCastle.Cms
6 | {
7 | internal class NullOutputStream
8 | : BaseOutputStream
9 | {
10 | public override void WriteByte(byte b)
11 | {
12 | // do nothing
13 | }
14 |
15 | public override void Write(byte[] buffer, int offset, int count)
16 | {
17 | // do nothing
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/cms/RecipientInfoGenerator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Org.BouncyCastle.Asn1.Cms;
4 | using Org.BouncyCastle.Crypto.Parameters;
5 | using Org.BouncyCastle.Security;
6 |
7 | namespace Org.BouncyCastle.Cms
8 | {
9 | interface RecipientInfoGenerator
10 | {
11 | ///
12 | /// Generate a RecipientInfo object for the given key.
13 | ///
14 | ///
15 | /// A
16 | ///
17 | ///
18 | /// A
19 | ///
20 | ///
21 | /// A
22 | ///
23 | ///
24 | RecipientInfo Generate(KeyParameter contentEncryptionKey, SecureRandom random);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/cms/SigOutputStream.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Org.BouncyCastle.Crypto;
4 | using Org.BouncyCastle.Utilities.IO;
5 | using Org.BouncyCastle.Security;
6 |
7 | namespace Org.BouncyCastle.Cms
8 | {
9 | internal class SigOutputStream
10 | : BaseOutputStream
11 | {
12 | private readonly ISigner sig;
13 |
14 | internal SigOutputStream(ISigner sig)
15 | {
16 | this.sig = sig;
17 | }
18 |
19 | public override void WriteByte(byte b)
20 | {
21 | try
22 | {
23 | sig.Update(b);
24 | }
25 | catch (SignatureException e)
26 | {
27 | throw new CmsStreamException("signature problem: " + e);
28 | }
29 | }
30 |
31 | public override void Write(byte[] b, int off, int len)
32 | {
33 | try
34 | {
35 | sig.BlockUpdate(b, off, len);
36 | }
37 | catch (SignatureException e)
38 | {
39 | throw new CmsStreamException("signature problem: " + e);
40 | }
41 | }
42 | }
43 | }
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/cms/SignerInfoGenerator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Org.BouncyCastle.Asn1;
4 | using Org.BouncyCastle.Asn1.Cms;
5 | using Org.BouncyCastle.Asn1.X509;
6 |
7 | namespace Org.BouncyCastle.Cms
8 | {
9 | internal interface SignerInfoGenerator
10 | {
11 | SignerInfo Generate(DerObjectIdentifier contentType, AlgorithmIdentifier digestAlgorithm,
12 | byte[] calculatedDigest);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/cms/SimpleAttributeTableGenerator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 |
4 | using Org.BouncyCastle.Asn1.Cms;
5 |
6 | namespace Org.BouncyCastle.Cms
7 | {
8 | /**
9 | * Basic generator that just returns a preconstructed attribute table
10 | */
11 | public class SimpleAttributeTableGenerator
12 | : CmsAttributeTableGenerator
13 | {
14 | private readonly AttributeTable attributes;
15 |
16 | public SimpleAttributeTableGenerator(
17 | AttributeTable attributes)
18 | {
19 | this.attributes = attributes;
20 | }
21 |
22 | public virtual AttributeTable GetAttributes(
23 | IDictionary parameters)
24 | {
25 | return attributes;
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/AsymmetricKeyParameter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Org.BouncyCastle.Crypto;
4 |
5 | namespace Org.BouncyCastle.Crypto
6 | {
7 | public class AsymmetricKeyParameter
8 | : ICipherParameters
9 | {
10 | private readonly bool privateKey;
11 |
12 | public AsymmetricKeyParameter(
13 | bool privateKey)
14 | {
15 | this.privateKey = privateKey;
16 | }
17 |
18 | public bool IsPrivate
19 | {
20 | get { return privateKey; }
21 | }
22 |
23 | public override bool Equals(
24 | object obj)
25 | {
26 | AsymmetricKeyParameter other = obj as AsymmetricKeyParameter;
27 |
28 | if (other == null)
29 | {
30 | return false;
31 | }
32 |
33 | return Equals(other);
34 | }
35 |
36 | protected bool Equals(
37 | AsymmetricKeyParameter other)
38 | {
39 | return privateKey == other.privateKey;
40 | }
41 |
42 | public override int GetHashCode()
43 | {
44 | return privateKey.GetHashCode();
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/CryptoException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Crypto
4 | {
5 | public class CryptoException
6 | : Exception
7 | {
8 | public CryptoException()
9 | {
10 | }
11 |
12 | public CryptoException(
13 | string message)
14 | : base(message)
15 | {
16 | }
17 |
18 | public CryptoException(
19 | string message,
20 | Exception exception)
21 | : base(message, exception)
22 | {
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/DataLengthException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Crypto
4 | {
5 | /**
6 | * this exception is thrown if a buffer that is meant to have output
7 | * copied into it turns out to be too short, or if we've been given
8 | * insufficient input. In general this exception will Get thrown rather
9 | * than an ArrayOutOfBounds exception.
10 | */
11 | public class DataLengthException
12 | : CryptoException
13 | {
14 | /**
15 | * base constructor.
16 | */
17 | public DataLengthException()
18 | {
19 | }
20 |
21 | /**
22 | * create a DataLengthException with the given message.
23 | *
24 | * @param message the message to be carried with the exception.
25 | */
26 | public DataLengthException(
27 | string message)
28 | : base(message)
29 | {
30 | }
31 |
32 | public DataLengthException(
33 | string message,
34 | Exception exception)
35 | : base(message, exception)
36 | {
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/IAsymmetricCipherKeyPairGenerator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Crypto
4 | {
5 | /**
6 | * interface that a public/private key pair generator should conform to.
7 | */
8 | public interface IAsymmetricCipherKeyPairGenerator
9 | {
10 | /**
11 | * intialise the key pair generator.
12 | *
13 | * @param the parameters the key pair is to be initialised with.
14 | */
15 | void Init(KeyGenerationParameters parameters);
16 |
17 | /**
18 | * return an AsymmetricCipherKeyPair containing the Generated keys.
19 | *
20 | * @return an AsymmetricCipherKeyPair containing the Generated keys.
21 | */
22 | AsymmetricCipherKeyPair GenerateKeyPair();
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/IBasicAgreement.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Org.BouncyCastle.Math;
3 |
4 | namespace Org.BouncyCastle.Crypto
5 | {
6 | /**
7 | * The basic interface that basic Diffie-Hellman implementations
8 | * conforms to.
9 | */
10 | public interface IBasicAgreement
11 | {
12 | /**
13 | * initialise the agreement engine.
14 | */
15 | void Init(ICipherParameters parameters);
16 |
17 | /**
18 | * given a public key from a given party calculate the next
19 | * message in the agreement sequence.
20 | */
21 | BigInteger CalculateAgreement(ICipherParameters pubKey);
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/ICipherParameters.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Crypto
4 | {
5 | /**
6 | * all parameter classes implement this.
7 | */
8 | public interface ICipherParameters
9 | {
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/IDerivationFunction.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Crypto
4 | {
5 | /**
6 | * base interface for general purpose byte derivation functions.
7 | */
8 | public interface IDerivationFunction
9 | {
10 | void Init(IDerivationParameters parameters);
11 |
12 | /**
13 | * return the message digest used as the basis for the function
14 | */
15 | IDigest Digest
16 | {
17 | get;
18 | }
19 |
20 | int GenerateBytes(byte[] output, int outOff, int length);
21 | //throws DataLengthException, ArgumentException;
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/IDerivationParameters.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Crypto
4 | {
5 | /**
6 | * Parameters for key/byte stream derivation classes
7 | */
8 | public interface IDerivationParameters
9 | {
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/IWrapper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Org.BouncyCastle.Security;
4 |
5 | namespace Org.BouncyCastle.Crypto
6 | {
7 | public interface IWrapper
8 | {
9 | /// The name of the algorithm this cipher implements.
10 | string AlgorithmName { get; }
11 |
12 | void Init(bool forWrapping, ICipherParameters parameters);
13 |
14 | byte[] Wrap(byte[] input, int inOff, int length);
15 |
16 | byte[] Unwrap(byte[] input, int inOff, int length);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/InvalidCipherTextException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Crypto
4 | {
5 | /**
6 | * this exception is thrown whenever we find something we don't expect in a
7 | * message.
8 | */
9 | public class InvalidCipherTextException
10 | : CryptoException
11 | {
12 | /**
13 | * base constructor.
14 | */
15 | public InvalidCipherTextException()
16 | {
17 | }
18 |
19 | /**
20 | * create a InvalidCipherTextException with the given message.
21 | *
22 | * @param message the message to be carried with the exception.
23 | */
24 | public InvalidCipherTextException(
25 | string message)
26 | : base(message)
27 | {
28 | }
29 |
30 | public InvalidCipherTextException(
31 | string message,
32 | Exception exception)
33 | : base(message, exception)
34 | {
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/MaxBytesExceededException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Crypto
4 | {
5 | ///
6 | /// This exception is thrown whenever a cipher requires a change of key, iv
7 | /// or similar after x amount of bytes enciphered
8 | ///
9 | public class MaxBytesExceededException
10 | : CryptoException
11 | {
12 | public MaxBytesExceededException()
13 | {
14 | }
15 |
16 | public MaxBytesExceededException(
17 | string message)
18 | : base(message)
19 | {
20 | }
21 |
22 | public MaxBytesExceededException(
23 | string message,
24 | Exception e)
25 | : base(message, e)
26 | {
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/digests/NullDigest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | namespace Org.BouncyCastle.Crypto.Digests
5 | {
6 | public class NullDigest : IDigest
7 | {
8 | private readonly MemoryStream bOut = new MemoryStream();
9 |
10 | public string AlgorithmName
11 | {
12 | get { return "NULL"; }
13 | }
14 |
15 | public int GetByteLength()
16 | {
17 | // TODO Is this okay?
18 | return 0;
19 | }
20 |
21 | public int GetDigestSize()
22 | {
23 | return (int) bOut.Length;
24 | }
25 |
26 | public void Update(byte b)
27 | {
28 | bOut.WriteByte(b);
29 | }
30 |
31 | public void BlockUpdate(byte[] inBytes, int inOff, int len)
32 | {
33 | bOut.Write(inBytes, inOff, len);
34 | }
35 |
36 | public int DoFinal(byte[] outBytes, int outOff)
37 | {
38 | byte[] res = bOut.ToArray();
39 | res.CopyTo(outBytes, outOff);
40 | Reset();
41 | return res.Length;
42 | }
43 |
44 | public void Reset()
45 | {
46 | bOut.SetLength(0);
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/engines/AesWrapEngine.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Crypto.Engines
2 | {
3 | ///
4 | /// An implementation of the AES Key Wrapper from the NIST Key Wrap Specification.
5 | ///
6 | /// For further details see: http://csrc.nist.gov/encryption/kms/key-wrap.pdf.
7 | ///
8 | public class AesWrapEngine
9 | : Rfc3394WrapEngine
10 | {
11 | public AesWrapEngine()
12 | : base(new AesEngine())
13 | {
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/engines/CamelliaWrapEngine.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Crypto.Engines
2 | {
3 | ///
4 | /// An implementation of the Camellia key wrapper based on RFC 3657/RFC 3394.
5 | ///
6 | /// For further details see: http://www.ietf.org/rfc/rfc3657.txt.
7 | ///
8 | public class CamelliaWrapEngine
9 | : Rfc3394WrapEngine
10 | {
11 | public CamelliaWrapEngine()
12 | : base(new CamelliaEngine())
13 | {
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/engines/SEEDWrapEngine.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Crypto.Engines
2 | {
3 | ///
4 | /// An implementation of the SEED key wrapper based on RFC 4010/RFC 3394.
5 | ///
6 | /// For further details see: http://www.ietf.org/rfc/rfc4010.txt.
7 | ///
8 | public class SeedWrapEngine
9 | : Rfc3394WrapEngine
10 | {
11 | public SeedWrapEngine()
12 | : base(new SeedEngine())
13 | {
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/generators/Kdf1BytesGenerator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Org.BouncyCastle.Crypto;
4 | using Org.BouncyCastle.Crypto.Parameters;
5 |
6 | namespace Org.BouncyCastle.Crypto.Generators
7 | {
8 | /**
9 | * KFD2 generator for derived keys and ivs as defined by IEEE P1363a/ISO 18033
10 | *
11 | * This implementation is based on IEEE P1363/ISO 18033.
12 | */
13 | public class Kdf1BytesGenerator
14 | : BaseKdfBytesGenerator
15 | {
16 | /**
17 | * Construct a KDF1 byte generator.
18 | *
19 | * @param digest the digest to be used as the source of derived keys.
20 | */
21 | public Kdf1BytesGenerator(
22 | IDigest digest)
23 | : base(0, digest)
24 | {
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/generators/Kdf2BytesGenerator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Org.BouncyCastle.Crypto;
4 | using Org.BouncyCastle.Crypto.Parameters;
5 |
6 | namespace Org.BouncyCastle.Crypto.Generators
7 | {
8 | /**
9 | * KFD2 generator for derived keys and ivs as defined by IEEE P1363a/ISO 18033
10 | *
11 | * This implementation is based on IEEE P1363/ISO 18033.
12 | */
13 | public class Kdf2BytesGenerator
14 | : BaseKdfBytesGenerator
15 | {
16 | /**
17 | * Construct a KDF2 bytes generator. Generates key material
18 | * according to IEEE P1363 or ISO 18033 depending on the initialisation.
19 | *
20 | * @param digest the digest to be used as the source of derived keys.
21 | */
22 | public Kdf2BytesGenerator(
23 | IDigest digest)
24 | : base(1, digest)
25 | {
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/modes/gcm/BasicGcmExponentiator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Org.BouncyCastle.Utilities;
4 |
5 | namespace Org.BouncyCastle.Crypto.Modes.Gcm
6 | {
7 | public class BasicGcmExponentiator
8 | : IGcmExponentiator
9 | {
10 | private byte[] x;
11 |
12 | public void Init(byte[] x)
13 | {
14 | this.x = Arrays.Clone(x);
15 | }
16 |
17 | public void ExponentiateX(long pow, byte[] output)
18 | {
19 | // Initial value is little-endian 1
20 | byte[] y = GcmUtilities.OneAsBytes();
21 |
22 | if (pow > 0)
23 | {
24 | byte[] powX = Arrays.Clone(x);
25 | do
26 | {
27 | if ((pow & 1L) != 0)
28 | {
29 | GcmUtilities.Multiply(y, powX);
30 | }
31 | GcmUtilities.Multiply(powX, powX);
32 | pow >>= 1;
33 | }
34 | while (pow > 0);
35 | }
36 |
37 | Array.Copy(y, 0, output, 0, 16);
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/modes/gcm/BasicGcmMultiplier.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Crypto.Modes.Gcm
4 | {
5 | public class BasicGcmMultiplier
6 | : IGcmMultiplier
7 | {
8 | private byte[] H;
9 |
10 | public void Init(byte[] H)
11 | {
12 | this.H = (byte[])H.Clone();
13 | }
14 |
15 | public void MultiplyH(byte[] x)
16 | {
17 | GcmUtilities.Multiply(x, H);
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/modes/gcm/IGcmExponentiator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Crypto.Modes.Gcm
4 | {
5 | public interface IGcmExponentiator
6 | {
7 | void Init(byte[] x);
8 | void ExponentiateX(long pow, byte[] output);
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/modes/gcm/IGcmMultiplier.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Crypto.Modes.Gcm
4 | {
5 | public interface IGcmMultiplier
6 | {
7 | void Init(byte[] H);
8 | void MultiplyH(byte[] x);
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/parameters/CcmParameters.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Crypto.Parameters
4 | {
5 | public class CcmParameters
6 | : AeadParameters
7 | {
8 | /**
9 | * Base constructor.
10 | *
11 | * @param key key to be used by underlying cipher
12 | * @param macSize macSize in bits
13 | * @param nonce nonce to be used
14 | * @param associatedText associated text, if any
15 | */
16 | public CcmParameters(
17 | KeyParameter key,
18 | int macSize,
19 | byte[] nonce,
20 | byte[] associatedText)
21 | : base(key, macSize, nonce, associatedText)
22 | {
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/parameters/DHKeyGenerationParameters.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Org.BouncyCastle.Security;
4 |
5 | namespace Org.BouncyCastle.Crypto.Parameters
6 | {
7 | public class DHKeyGenerationParameters
8 | : KeyGenerationParameters
9 | {
10 | private readonly DHParameters parameters;
11 |
12 | public DHKeyGenerationParameters(
13 | SecureRandom random,
14 | DHParameters parameters)
15 | : base(random, GetStrength(parameters))
16 | {
17 | this.parameters = parameters;
18 | }
19 |
20 | public DHParameters Parameters
21 | {
22 | get { return parameters; }
23 | }
24 |
25 | internal static int GetStrength(
26 | DHParameters parameters)
27 | {
28 | return parameters.L != 0 ? parameters.L : parameters.P.BitLength;
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/parameters/DsaKeyGenerationParameters.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Org.BouncyCastle.Security;
4 |
5 | namespace Org.BouncyCastle.Crypto.Parameters
6 | {
7 | public class DsaKeyGenerationParameters
8 | : KeyGenerationParameters
9 | {
10 | private readonly DsaParameters parameters;
11 |
12 | public DsaKeyGenerationParameters(
13 | SecureRandom random,
14 | DsaParameters parameters)
15 | : base(random, parameters.P.BitLength - 1)
16 | {
17 | this.parameters = parameters;
18 | }
19 |
20 | public DsaParameters Parameters
21 | {
22 | get { return parameters; }
23 | }
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/parameters/ElGamalKeyGenerationParameters.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Org.BouncyCastle.Security;
4 |
5 | namespace Org.BouncyCastle.Crypto.Parameters
6 | {
7 | public class ElGamalKeyGenerationParameters
8 | : KeyGenerationParameters
9 | {
10 | private readonly ElGamalParameters parameters;
11 |
12 | public ElGamalKeyGenerationParameters(
13 | SecureRandom random,
14 | ElGamalParameters parameters)
15 | : base(random, GetStrength(parameters))
16 | {
17 | this.parameters = parameters;
18 | }
19 |
20 | public ElGamalParameters Parameters
21 | {
22 | get { return parameters; }
23 | }
24 |
25 | internal static int GetStrength(
26 | ElGamalParameters parameters)
27 | {
28 | return parameters.L != 0 ? parameters.L : parameters.P.BitLength;
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/parameters/GOST3410PrivateKeyParameters.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Org.BouncyCastle.Asn1;
4 | using Org.BouncyCastle.Asn1.CryptoPro;
5 | using Org.BouncyCastle.Math;
6 |
7 | namespace Org.BouncyCastle.Crypto.Parameters
8 | {
9 | public class Gost3410PrivateKeyParameters
10 | : Gost3410KeyParameters
11 | {
12 | private readonly BigInteger x;
13 |
14 | public Gost3410PrivateKeyParameters(
15 | BigInteger x,
16 | Gost3410Parameters parameters)
17 | : base(true, parameters)
18 | {
19 | if (x.SignValue < 1 || x.BitLength > 256 || x.CompareTo(Parameters.Q) >= 0)
20 | throw new ArgumentException("Invalid x for GOST3410 private key", "x");
21 |
22 | this.x = x;
23 | }
24 |
25 | public Gost3410PrivateKeyParameters(
26 | BigInteger x,
27 | DerObjectIdentifier publicKeyParamSet)
28 | : base(true, publicKeyParamSet)
29 | {
30 | if (x.SignValue < 1 || x.BitLength > 256 || x.CompareTo(Parameters.Q) >= 0)
31 | throw new ArgumentException("Invalid x for GOST3410 private key", "x");
32 |
33 | this.x = x;
34 | }
35 |
36 | public BigInteger X
37 | {
38 | get { return x; }
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/parameters/GOST3410PublicKeyParameters.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Org.BouncyCastle.Asn1;
4 | using Org.BouncyCastle.Math;
5 |
6 | namespace Org.BouncyCastle.Crypto.Parameters
7 | {
8 | public class Gost3410PublicKeyParameters
9 | : Gost3410KeyParameters
10 | {
11 | private readonly BigInteger y;
12 |
13 | public Gost3410PublicKeyParameters(
14 | BigInteger y,
15 | Gost3410Parameters parameters)
16 | : base(false, parameters)
17 | {
18 | if (y.SignValue < 1 || y.CompareTo(Parameters.P) >= 0)
19 | throw new ArgumentException("Invalid y for GOST3410 public key", "y");
20 |
21 | this.y = y;
22 | }
23 |
24 | public Gost3410PublicKeyParameters(
25 | BigInteger y,
26 | DerObjectIdentifier publicKeyParamSet)
27 | : base(false, publicKeyParamSet)
28 | {
29 | if (y.SignValue < 1 || y.CompareTo(Parameters.P) >= 0)
30 | throw new ArgumentException("Invalid y for GOST3410 public key", "y");
31 |
32 | this.y = y;
33 | }
34 |
35 | public BigInteger Y
36 | {
37 | get { return y; }
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/parameters/ISO18033KDFParameters.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Org.BouncyCastle.Crypto;
3 |
4 | namespace Org.BouncyCastle.Crypto.Parameters
5 | {
6 | /**
7 | * parameters for Key derivation functions for ISO-18033
8 | */
9 | public class Iso18033KdfParameters
10 | : IDerivationParameters
11 | {
12 | byte[] seed;
13 |
14 | public Iso18033KdfParameters(
15 | byte[] seed)
16 | {
17 | this.seed = seed;
18 | }
19 |
20 | public byte[] GetSeed()
21 | {
22 | return seed;
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/parameters/IesWithCipherParameters.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Crypto.Parameters
4 | {
5 | public class IesWithCipherParameters : IesParameters
6 | {
7 | private int cipherKeySize;
8 |
9 | /**
10 | * @param derivation the derivation parameter for the KDF function.
11 | * @param encoding the encoding parameter for the KDF function.
12 | * @param macKeySize the size of the MAC key (in bits).
13 | * @param cipherKeySize the size of the associated Cipher key (in bits).
14 | */
15 | public IesWithCipherParameters(
16 | byte[] derivation,
17 | byte[] encoding,
18 | int macKeySize,
19 | int cipherKeySize) : base(derivation, encoding, macKeySize)
20 | {
21 | this.cipherKeySize = cipherKeySize;
22 | }
23 |
24 | public int CipherKeySize
25 | {
26 | get
27 | {
28 | return cipherKeySize;
29 | }
30 | }
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/parameters/KdfParameters.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Org.BouncyCastle.Crypto;
3 |
4 | namespace Org.BouncyCastle.Crypto.Parameters
5 | {
6 | /**
7 | * parameters for Key derivation functions for IEEE P1363a
8 | */
9 | public class KdfParameters : IDerivationParameters
10 | {
11 | byte[] iv;
12 | byte[] shared;
13 |
14 | public KdfParameters(
15 | byte[] shared,
16 | byte[] iv)
17 | {
18 | this.shared = shared;
19 | this.iv = iv;
20 | }
21 |
22 | public byte[] GetSharedSecret()
23 | {
24 | return shared;
25 | }
26 |
27 | public byte[] GetIV()
28 | {
29 | return iv;
30 | }
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/parameters/KeyParameter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Org.BouncyCastle.Crypto;
4 |
5 | namespace Org.BouncyCastle.Crypto.Parameters
6 | {
7 | public class KeyParameter
8 | : ICipherParameters
9 | {
10 | private readonly byte[] key;
11 |
12 | public KeyParameter(
13 | byte[] key)
14 | {
15 | if (key == null)
16 | throw new ArgumentNullException("key");
17 |
18 | this.key = (byte[]) key.Clone();
19 | }
20 |
21 | public KeyParameter(
22 | byte[] key,
23 | int keyOff,
24 | int keyLen)
25 | {
26 | if (key == null)
27 | throw new ArgumentNullException("key");
28 | if (keyOff < 0 || keyOff > key.Length)
29 | throw new ArgumentOutOfRangeException("keyOff");
30 | if (keyLen < 0 || (keyOff + keyLen) > key.Length)
31 | throw new ArgumentOutOfRangeException("keyLen");
32 |
33 | this.key = new byte[keyLen];
34 | Array.Copy(key, keyOff, this.key, 0, keyLen);
35 | }
36 |
37 | public byte[] GetKey()
38 | {
39 | return (byte[]) key.Clone();
40 | }
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/parameters/MgfParameters.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Crypto.Parameters
4 | {
5 | /// Parameters for mask derivation functions.
6 | public class MgfParameters
7 | : IDerivationParameters
8 | {
9 | private readonly byte[] seed;
10 |
11 | public MgfParameters(
12 | byte[] seed)
13 | : this(seed, 0, seed.Length)
14 | {
15 | }
16 |
17 | public MgfParameters(
18 | byte[] seed,
19 | int off,
20 | int len)
21 | {
22 | this.seed = new byte[len];
23 | Array.Copy(seed, off, this.seed, 0, len);
24 | }
25 |
26 | public byte[] GetSeed()
27 | {
28 | return (byte[]) seed.Clone();
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/parameters/MqvPublicParameters.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Crypto.Parameters
4 | {
5 | public class MqvPublicParameters
6 | : ICipherParameters
7 | {
8 | private readonly ECPublicKeyParameters staticPublicKey;
9 | private readonly ECPublicKeyParameters ephemeralPublicKey;
10 |
11 | public MqvPublicParameters(
12 | ECPublicKeyParameters staticPublicKey,
13 | ECPublicKeyParameters ephemeralPublicKey)
14 | {
15 | this.staticPublicKey = staticPublicKey;
16 | this.ephemeralPublicKey = ephemeralPublicKey;
17 | }
18 |
19 | public ECPublicKeyParameters StaticPublicKey
20 | {
21 | get { return staticPublicKey; }
22 | }
23 |
24 | public ECPublicKeyParameters EphemeralPublicKey
25 | {
26 | get { return ephemeralPublicKey; }
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/parameters/ParametersWithSBox.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Org.BouncyCastle.Crypto;
4 |
5 | namespace Org.BouncyCastle.Crypto.Parameters
6 | {
7 | public class ParametersWithSBox : ICipherParameters
8 | {
9 | private ICipherParameters parameters;
10 | private byte[] sBox;
11 |
12 | public ParametersWithSBox(
13 | ICipherParameters parameters,
14 | byte[] sBox)
15 | {
16 | this.parameters = parameters;
17 | this.sBox = sBox;
18 | }
19 |
20 | public byte[] GetSBox() { return sBox; }
21 |
22 | public ICipherParameters Parameters { get { return parameters; } }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/parameters/ParametersWithSalt.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Org.BouncyCastle.Crypto;
4 |
5 | namespace Org.BouncyCastle.Crypto.Parameters
6 | {
7 |
8 | /// Cipher parameters with a fixed salt value associated with them.
9 | public class ParametersWithSalt : ICipherParameters
10 | {
11 | private byte[] salt;
12 | private ICipherParameters parameters;
13 |
14 | public ParametersWithSalt(ICipherParameters parameters, byte[] salt):this(parameters, salt, 0, salt.Length)
15 | {
16 | }
17 |
18 | public ParametersWithSalt(ICipherParameters parameters, byte[] salt, int saltOff, int saltLen)
19 | {
20 | this.salt = new byte[saltLen];
21 | this.parameters = parameters;
22 |
23 | Array.Copy(salt, saltOff, this.salt, 0, saltLen);
24 | }
25 |
26 | public byte[] GetSalt()
27 | {
28 | return salt;
29 | }
30 |
31 | public ICipherParameters Parameters
32 | {
33 | get
34 | {
35 | return parameters;
36 | }
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/parameters/RC2Parameters.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Crypto.Parameters
4 | {
5 | public class RC2Parameters
6 | : KeyParameter
7 | {
8 | private readonly int bits;
9 |
10 | public RC2Parameters(
11 | byte[] key)
12 | : this(key, (key.Length > 128) ? 1024 : (key.Length * 8))
13 | {
14 | }
15 |
16 | public RC2Parameters(
17 | byte[] key,
18 | int keyOff,
19 | int keyLen)
20 | : this(key, keyOff, keyLen, (keyLen > 128) ? 1024 : (keyLen * 8))
21 | {
22 | }
23 |
24 | public RC2Parameters(
25 | byte[] key,
26 | int bits)
27 | : base(key)
28 | {
29 | this.bits = bits;
30 | }
31 |
32 | public RC2Parameters(
33 | byte[] key,
34 | int keyOff,
35 | int keyLen,
36 | int bits)
37 | : base(key, keyOff, keyLen)
38 | {
39 | this.bits = bits;
40 | }
41 |
42 | public int EffectiveKeyBits
43 | {
44 | get { return bits; }
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/parameters/RC5Parameters.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Org.BouncyCastle.Crypto;
3 |
4 | namespace Org.BouncyCastle.Crypto.Parameters
5 | {
6 | public class RC5Parameters
7 | : KeyParameter
8 | {
9 | private readonly int rounds;
10 |
11 | public RC5Parameters(
12 | byte[] key,
13 | int rounds)
14 | : base(key)
15 | {
16 | if (key.Length > 255)
17 | throw new ArgumentException("RC5 key length can be no greater than 255");
18 |
19 | this.rounds = rounds;
20 | }
21 |
22 | public int Rounds
23 | {
24 | get { return rounds; }
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/parameters/RSABlindingParameters.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Org.BouncyCastle.Math;
4 |
5 | namespace Org.BouncyCastle.Crypto.Parameters
6 | {
7 | public class RsaBlindingParameters
8 | : ICipherParameters
9 | {
10 | private readonly RsaKeyParameters publicKey;
11 | private readonly BigInteger blindingFactor;
12 |
13 | public RsaBlindingParameters(
14 | RsaKeyParameters publicKey,
15 | BigInteger blindingFactor)
16 | {
17 | if (publicKey.IsPrivate)
18 | throw new ArgumentException("RSA parameters should be for a public key");
19 |
20 | this.publicKey = publicKey;
21 | this.blindingFactor = blindingFactor;
22 | }
23 |
24 | public RsaKeyParameters PublicKey
25 | {
26 | get { return publicKey; }
27 | }
28 |
29 | public BigInteger BlindingFactor
30 | {
31 | get { return blindingFactor; }
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/prng/IRandomGenerator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Crypto.Prng
4 | {
5 | /// Generic interface for objects generating random bytes.
6 | public interface IRandomGenerator
7 | {
8 | /// Add more seed material to the generator.
9 | /// A byte array to be mixed into the generator's state.
10 | void AddSeedMaterial(byte[] seed);
11 |
12 | /// Add more seed material to the generator.
13 | /// A long value to be mixed into the generator's state.
14 | void AddSeedMaterial(long seed);
15 |
16 | /// Fill byte array with random values.
17 | /// Array to be filled.
18 | void NextBytes(byte[] bytes);
19 |
20 | /// Fill byte array with random values.
21 | /// Array to receive bytes.
22 | /// Index to start filling at.
23 | /// Length of segment to fill.
24 | void NextBytes(byte[] bytes, int start, int len);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/tls/AlertLevel.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Crypto.Tls
2 | {
3 | ///
4 | /// RFC 2246 7.2
5 | ///
6 | public enum AlertLevel : byte
7 | {
8 | warning = 1,
9 | fatal = 2,
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/tls/AlwaysValidVerifyer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Org.BouncyCastle.Asn1.X509;
4 |
5 | namespace Org.BouncyCastle.Crypto.Tls
6 | {
7 | ///
8 | /// A certificate verifyer, that will always return true.
9 | ///
10 | /// DO NOT USE THIS FILE UNLESS YOU KNOW EXACTLY WHAT YOU ARE DOING.
11 | ///
12 | ///
13 | [Obsolete("Perform certificate verification in TlsAuthentication implementation")]
14 | public class AlwaysValidVerifyer
15 | : ICertificateVerifyer
16 | {
17 | /// Return true.
18 | public bool IsValid(
19 | X509CertificateStructure[] certs)
20 | {
21 | return true;
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/tls/CertificateRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 |
4 | namespace Org.BouncyCastle.Crypto.Tls
5 | {
6 | public class CertificateRequest
7 | {
8 | private ClientCertificateType[] certificateTypes;
9 | private IList certificateAuthorities;
10 |
11 | public CertificateRequest(ClientCertificateType[] certificateTypes, IList certificateAuthorities)
12 | {
13 | this.certificateTypes = certificateTypes;
14 | this.certificateAuthorities = certificateAuthorities;
15 | }
16 |
17 | public ClientCertificateType[] CertificateTypes
18 | {
19 | get { return certificateTypes; }
20 | }
21 |
22 | /// A of X509Name
23 | public IList CertificateAuthorities
24 | {
25 | get { return certificateAuthorities; }
26 | }
27 | }
28 | }
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/tls/ClientCertificateType.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Crypto.Tls
2 | {
3 | ///
4 | /// RFC 2246 7.4.4
5 | ///
6 | public enum ClientCertificateType : byte
7 | {
8 | rsa_sign = 1,
9 | dss_sign = 2,
10 | rsa_fixed_dh = 3,
11 | dss_fixed_dh = 4,
12 |
13 | /*
14 | * RFC 4492 5.5
15 | */
16 | ecdsa_sign = 64,
17 | rsa_fixed_ecdh = 65,
18 | ecdsa_fixed_ecdh = 66,
19 | }
20 | }
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/tls/CompressionMethod.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Crypto.Tls
2 | {
3 | ///
4 | /// RFC 2246 6.1
5 | ///
6 | public enum CompressionMethod : byte
7 | {
8 | NULL = 0,
9 |
10 | /*
11 | * RFC 3749 2
12 | */
13 | DEFLATE = 1
14 |
15 | /*
16 | * Values from 224 decimal (0xE0) through 255 decimal (0xFF)
17 | * inclusive are reserved for private use.
18 | */
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/tls/ContentType.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Crypto.Tls
2 | {
3 | ///
4 | /// RFC 2246 6.2.1
5 | ///
6 | public enum ContentType : byte
7 | {
8 | change_cipher_spec = 20,
9 | alert = 21,
10 | handshake = 22,
11 | application_data = 23,
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/tls/DigestAlgorithm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Crypto.Tls
4 | {
5 | public enum DigestAlgorithm
6 | {
7 | /*
8 | * Note that the values here are implementation-specific and arbitrary.
9 | * It is recommended not to depend on the particular values (e.g. serialization).
10 | */
11 | NULL,
12 | MD5,
13 | SHA,
14 |
15 | /*
16 | * RFC 5289
17 | */
18 | SHA256,
19 | SHA384,
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/tls/ECCurveType.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Crypto.Tls
2 | {
3 | ///
4 | /// RFC 4492 5.4
5 | ///
6 | public enum ECCurveType : byte
7 | {
8 | /**
9 | * Indicates the elliptic curve domain parameters are conveyed verbosely, and the
10 | * underlying finite field is a prime field.
11 | */
12 | explicit_prime = 1,
13 |
14 | /**
15 | * Indicates the elliptic curve domain parameters are conveyed verbosely, and the
16 | * underlying finite field is a characteristic-2 field.
17 | */
18 | explicit_char2 = 2,
19 |
20 | /**
21 | * Indicates that a named curve is used. This option SHOULD be used when applicable.
22 | */
23 | named_curve = 3,
24 |
25 | /*
26 | * Values 248 through 255 are reserved for private use.
27 | */
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/tls/ECPointFormat.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Crypto.Tls
2 | {
3 | ///
4 | /// RFC 4492 5.1.2
5 | ///
6 | public enum ECPointFormat : byte
7 | {
8 | uncompressed = 0,
9 | ansiX962_compressed_prime = 1,
10 | ansiX962_compressed_char2 = 2,
11 |
12 | /*
13 | * reserved (248..255)
14 | */
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/tls/EncryptionAlgorithm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Crypto.Tls
4 | {
5 | public enum EncryptionAlgorithm
6 | {
7 | /*
8 | * Note that the values here are implementation-specific and arbitrary.
9 | * It is recommended not to depend on the particular values (e.g. serialization).
10 | */
11 | NULL,
12 | RC4_40,
13 | RC4_128,
14 | RC2_CBC_40,
15 | IDEA_CBC,
16 | DES40_CBC,
17 | DES_CBC,
18 | cls_3DES_EDE_CBC,
19 |
20 | /*
21 | * RFC 3268
22 | */
23 | AES_128_CBC,
24 | AES_256_CBC,
25 |
26 | /*
27 | * RFC 5289
28 | */
29 | AES_128_GCM,
30 | AES_256_GCM,
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/tls/ExtensionType.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Crypto.Tls
2 | {
3 | ///
4 | /// RFC 4366 2.3
5 | ///
6 | public enum ExtensionType : int
7 | {
8 | server_name = 0,
9 | max_fragment_length = 1,
10 | client_certificate_url = 2,
11 | trusted_ca_keys = 3,
12 | truncated_hmac = 4,
13 | status_request = 5,
14 |
15 | /*
16 | * RFC 4492
17 | */
18 | elliptic_curves = 10,
19 | ec_point_formats = 11,
20 |
21 | /*
22 | * RFC 5054 2.8.1
23 | */
24 | srp = 12,
25 |
26 | /*
27 | * RFC 5746 6
28 | */
29 | renegotiation_info = 0xff01,
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/tls/HandshakeType.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Crypto.Tls
2 | {
3 | ///
4 | /// RFC 2246 7.4
5 | ///
6 | public enum HandshakeType : byte
7 | {
8 | hello_request = 0,
9 | client_hello = 1,
10 | server_hello = 2,
11 | certificate = 11,
12 | server_key_exchange = 12,
13 | certificate_request = 13,
14 | server_hello_done = 14,
15 | certificate_verify = 15,
16 | client_key_exchange = 16,
17 | finished = 20,
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/tls/ICertificateVerifyer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Org.BouncyCastle.Asn1.X509;
4 |
5 | namespace Org.BouncyCastle.Crypto.Tls
6 | {
7 | ///
8 | /// This should be implemented by any class which can find out, if a given
9 | /// certificate chain is being accepted by an client.
10 | ///
11 | [Obsolete("Perform certificate verification in TlsAuthentication implementation")]
12 | public interface ICertificateVerifyer
13 | {
14 | /// The certs, which are part of the chain.
15 | /// True, if the chain is accepted, false otherwise
16 | bool IsValid(X509CertificateStructure[] certs);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/tls/KeyExchangeAlgorithm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Crypto.Tls
4 | {
5 | public enum KeyExchangeAlgorithm
6 | {
7 | /*
8 | * Note that the values here are implementation-specific and arbitrary.
9 | * It is recommended not to depend on the particular values (e.g. serialization).
10 | */
11 | NULL,
12 | RSA,
13 | RSA_EXPORT,
14 | DHE_DSS,
15 | DHE_DSS_EXPORT,
16 | DHE_RSA,
17 | DHE_RSA_EXPORT,
18 | DH_DSS,
19 | DH_DSS_EXPORT,
20 | DH_RSA,
21 | DH_RSA_EXPORT,
22 | DH_anon,
23 | DH_anon_export,
24 | PSK,
25 | DHE_PSK,
26 | RSA_PSK,
27 | ECDH_ECDSA,
28 | ECDHE_ECDSA,
29 | ECDH_RSA,
30 | ECDHE_RSA,
31 | ECDH_anon,
32 | SRP,
33 | SRP_DSS,
34 | SRP_RSA,
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/tls/LegacyTlsAuthentication.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Crypto.Tls
4 | {
5 | ///
6 | /// A temporary class to wrap old CertificateVerifyer stuff for new TlsAuthentication.
7 | ///
8 | [Obsolete]
9 | public class LegacyTlsAuthentication
10 | : TlsAuthentication
11 | {
12 | protected ICertificateVerifyer verifyer;
13 |
14 | public LegacyTlsAuthentication(ICertificateVerifyer verifyer)
15 | {
16 | this.verifyer = verifyer;
17 | }
18 |
19 | public virtual void NotifyServerCertificate(Certificate serverCertificate)
20 | {
21 | if (!this.verifyer.IsValid(serverCertificate.GetCerts()))
22 | throw new TlsFatalAlert(AlertDescription.user_canceled);
23 | }
24 |
25 | public virtual TlsCredentials GetClientCredentials(CertificateRequest certificateRequest)
26 | {
27 | return null;
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/tls/LegacyTlsClient.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Crypto.Tls
4 | {
5 | ///
6 | /// A temporary class to use LegacyTlsAuthentication
7 | ///
8 | [Obsolete]
9 | public class LegacyTlsClient
10 | : DefaultTlsClient
11 | {
12 | [Obsolete]
13 | protected ICertificateVerifyer verifyer;
14 |
15 | [Obsolete]
16 | public LegacyTlsClient(ICertificateVerifyer verifyer)
17 | {
18 | this.verifyer = verifyer;
19 | }
20 |
21 | public override TlsAuthentication GetAuthentication()
22 | {
23 | return new LegacyTlsAuthentication(verifyer);
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/tls/SecurityParameters.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Crypto.Tls
4 | {
5 | public class SecurityParameters
6 | {
7 | internal byte[] clientRandom = null;
8 | internal byte[] serverRandom = null;
9 | internal byte[] masterSecret = null;
10 |
11 | public byte[] ClientRandom
12 | {
13 | get { return clientRandom; }
14 | }
15 |
16 | public byte[] ServerRandom
17 | {
18 | get { return serverRandom; }
19 | }
20 |
21 | public byte[] MasterSecret
22 | {
23 | get { return masterSecret; }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/tls/TlsAgreementCredentials.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | namespace Org.BouncyCastle.Crypto.Tls
5 | {
6 | public interface TlsAgreementCredentials : TlsCredentials
7 | {
8 | ///
9 | byte[] GenerateAgreement(AsymmetricKeyParameter serverPublicKey);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/tls/TlsCipher.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | namespace Org.BouncyCastle.Crypto.Tls
5 | {
6 | public interface TlsCipher
7 | {
8 | ///
9 | byte[] EncodePlaintext(ContentType type, byte[] plaintext, int offset, int len);
10 |
11 | ///
12 | byte[] DecodeCiphertext(ContentType type, byte[] ciphertext, int offset, int len);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/tls/TlsCipherFactory.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | namespace Org.BouncyCastle.Crypto.Tls
5 | {
6 | public interface TlsCipherFactory
7 | {
8 | ///
9 | TlsCipher CreateCipher(TlsClientContext context, EncryptionAlgorithm encryptionAlgorithm,
10 | DigestAlgorithm digestAlgorithm);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/tls/TlsClientContext.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Org.BouncyCastle.Security;
4 |
5 | namespace Org.BouncyCastle.Crypto.Tls
6 | {
7 | public interface TlsClientContext
8 | {
9 | SecureRandom SecureRandom { get; }
10 |
11 | SecurityParameters SecurityParameters { get; }
12 |
13 | object UserObject { get; set; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/tls/TlsClientContextImpl.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Org.BouncyCastle.Security;
4 |
5 | namespace Org.BouncyCastle.Crypto.Tls
6 | {
7 | internal class TlsClientContextImpl
8 | : TlsClientContext
9 | {
10 | private readonly SecureRandom secureRandom;
11 | private readonly SecurityParameters securityParameters;
12 |
13 | private object userObject = null;
14 |
15 | internal TlsClientContextImpl(SecureRandom secureRandom, SecurityParameters securityParameters)
16 | {
17 | this.secureRandom = secureRandom;
18 | this.securityParameters = securityParameters;
19 | }
20 |
21 | public virtual SecureRandom SecureRandom
22 | {
23 | get { return secureRandom; }
24 | }
25 |
26 | public virtual SecurityParameters SecurityParameters
27 | {
28 | get { return securityParameters; }
29 | }
30 |
31 | public virtual object UserObject
32 | {
33 | get { return userObject; }
34 | set { this.userObject = value; }
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/tls/TlsCompression.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | namespace Org.BouncyCastle.Crypto.Tls
5 | {
6 | public interface TlsCompression
7 | {
8 | Stream Compress(Stream output);
9 |
10 | Stream Decompress(Stream output);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/tls/TlsCredentials.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Crypto.Tls
4 | {
5 | public interface TlsCredentials
6 | {
7 | Certificate Certificate { get; }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/tls/TlsDeflateCompression.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | using Org.BouncyCastle.Utilities.Zlib;
5 |
6 | namespace Org.BouncyCastle.Crypto.Tls
7 | {
8 | public class TlsDeflateCompression
9 | : TlsCompression
10 | {
11 | protected ZStream zIn, zOut;
12 |
13 | public TlsDeflateCompression()
14 | {
15 | this.zIn = new ZStream();
16 | this.zIn.inflateInit();
17 |
18 | this.zOut = new ZStream();
19 | // TODO Allow custom setting
20 | this.zOut.deflateInit(JZlib.Z_DEFAULT_COMPRESSION);
21 | }
22 |
23 | public virtual Stream Compress(Stream output)
24 | {
25 | return new DeflateOutputStream(output, zOut, true);
26 | }
27 |
28 | public virtual Stream Decompress(Stream output)
29 | {
30 | return new DeflateOutputStream(output, zIn, false);
31 | }
32 |
33 | protected class DeflateOutputStream : ZOutputStream
34 | {
35 | public DeflateOutputStream(Stream output, ZStream z, bool compress)
36 | : base(output)
37 | {
38 | this.z = z;
39 | this.compress = compress;
40 | this.FlushMode = JZlib.Z_PARTIAL_FLUSH;
41 | }
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/tls/TlsDssSigner.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Org.BouncyCastle.Crypto.Parameters;
4 | using Org.BouncyCastle.Crypto.Signers;
5 |
6 | namespace Org.BouncyCastle.Crypto.Tls
7 | {
8 | internal class TlsDssSigner
9 | : TlsDsaSigner
10 | {
11 | public override bool IsValidPublicKey(AsymmetricKeyParameter publicKey)
12 | {
13 | return publicKey is DsaPublicKeyParameters;
14 | }
15 |
16 | protected override IDsa CreateDsaImpl()
17 | {
18 | return new DsaSigner();
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/tls/TlsECDsaSigner.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Org.BouncyCastle.Crypto.Parameters;
4 | using Org.BouncyCastle.Crypto.Signers;
5 |
6 | namespace Org.BouncyCastle.Crypto.Tls
7 | {
8 | internal class TlsECDsaSigner
9 | : TlsDsaSigner
10 | {
11 | public override bool IsValidPublicKey(AsymmetricKeyParameter publicKey)
12 | {
13 | return publicKey is ECPublicKeyParameters;
14 | }
15 |
16 | protected override IDsa CreateDsaImpl()
17 | {
18 | return new ECDsaSigner();
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/tls/TlsException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Crypto.Tls
4 | {
5 | public class TlsException : Exception
6 | {
7 | public TlsException() : base() { }
8 | public TlsException(string message) : base(message) { }
9 | public TlsException(string message, Exception exception) : base(message, exception) { }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/tls/TlsFatalAlert.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | namespace Org.BouncyCastle.Crypto.Tls
5 | {
6 | public class TlsFatalAlert
7 | : IOException
8 | {
9 | private readonly AlertDescription alertDescription;
10 |
11 | public TlsFatalAlert(AlertDescription alertDescription)
12 | {
13 | this.alertDescription = alertDescription;
14 | }
15 |
16 | public AlertDescription AlertDescription
17 | {
18 | get { return alertDescription; }
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/tls/TlsNullCipher.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Crypto.Tls
4 | {
5 | ///
6 | /// A NULL cipher suite, for use during handshake.
7 | ///
8 | public class TlsNullCipher
9 | : TlsCipher
10 | {
11 | public virtual byte[] EncodePlaintext(ContentType type, byte[] plaintext, int offset, int len)
12 | {
13 | return CopyData(plaintext, offset, len);
14 | }
15 |
16 | public virtual byte[] DecodeCiphertext(ContentType type, byte[] ciphertext, int offset, int len)
17 | {
18 | return CopyData(ciphertext, offset, len);
19 | }
20 |
21 | protected virtual byte[] CopyData(byte[] text, int offset, int len)
22 | {
23 | byte[] result = new byte[len];
24 | Array.Copy(text, offset, result, 0, len);
25 | return result;
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/tls/TlsNullCompression.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | namespace Org.BouncyCastle.Crypto.Tls
5 | {
6 | public class TlsNullCompression
7 | : TlsCompression
8 | {
9 | public virtual Stream Compress(Stream output)
10 | {
11 | return output;
12 | }
13 |
14 | public virtual Stream Decompress(Stream output)
15 | {
16 | return output;
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/tls/TlsSigner.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Org.BouncyCastle.Security;
4 |
5 | namespace Org.BouncyCastle.Crypto.Tls
6 | {
7 | public interface TlsSigner
8 | {
9 | byte[] CalculateRawSignature(SecureRandom random, AsymmetricKeyParameter privateKey,
10 | byte[] md5andsha1);
11 | bool VerifyRawSignature(byte[] sigBytes, AsymmetricKeyParameter publicKey, byte[] md5andsha1);
12 |
13 | ISigner CreateSigner(SecureRandom random, AsymmetricKeyParameter privateKey);
14 | ISigner CreateVerifyer(AsymmetricKeyParameter publicKey);
15 |
16 | bool IsValidPublicKey(AsymmetricKeyParameter publicKey);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/crypto/tls/TlsSignerCredentials.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | namespace Org.BouncyCastle.Crypto.Tls
5 | {
6 | public interface TlsSignerCredentials : TlsCredentials
7 | {
8 | ///
9 | byte[] GenerateCertificateSignature(byte[] md5andsha1);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/math/ec/abc/ZTauElement.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Math.EC.Abc
2 | {
3 | /**
4 | * Class representing an element of Z[τ]
. Let
5 | * λ
be an element of Z[τ]
. Then
6 | * λ
is given as λ = u + vτ
. The
7 | * components u
and v
may be used directly, there
8 | * are no accessor methods.
9 | * Immutable class.
10 | */
11 | internal class ZTauElement
12 | {
13 | /**
14 | * The "real" part of λ
.
15 | */
16 | public readonly BigInteger u;
17 |
18 | /**
19 | * The "τ
-adic" part of λ
.
20 | */
21 | public readonly BigInteger v;
22 |
23 | /**
24 | * Constructor for an element λ
of
25 | * Z[τ]
.
26 | * @param u The "real" part of λ
.
27 | * @param v The "τ
-adic" part of
28 | * λ
.
29 | */
30 | public ZTauElement(BigInteger u, BigInteger v)
31 | {
32 | this.u = u;
33 | this.v = v;
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/math/ec/multiplier/ECMultiplier.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Math.EC.Multiplier
2 | {
3 | /**
4 | * Interface for classes encapsulating a point multiplication algorithm
5 | * for ECPoint
s.
6 | */
7 | internal interface ECMultiplier
8 | {
9 | /**
10 | * Multiplies the ECPoint p
by k
, i.e.
11 | * p
is added k
times to itself.
12 | * @param p The ECPoint
to be multiplied.
13 | * @param k The factor by which p
i multiplied.
14 | * @return p
multiplied by k
.
15 | */
16 | ECPoint Multiply(ECPoint p, BigInteger k, PreCompInfo preCompInfo);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/math/ec/multiplier/FpNafMultiplier.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Math.EC.Multiplier
2 | {
3 | /**
4 | * Class implementing the NAF (Non-Adjacent Form) multiplication algorithm.
5 | */
6 | internal class FpNafMultiplier
7 | : ECMultiplier
8 | {
9 | /**
10 | * D.3.2 pg 101
11 | * @see org.bouncycastle.math.ec.multiplier.ECMultiplier#multiply(org.bouncycastle.math.ec.ECPoint, java.math.BigInteger)
12 | */
13 | public ECPoint Multiply(ECPoint p, BigInteger k, PreCompInfo preCompInfo)
14 | {
15 | // TODO Probably should try to add this
16 | // BigInteger e = k.Mod(n); // n == order of p
17 | BigInteger e = k;
18 | BigInteger h = e.Multiply(BigInteger.Three);
19 |
20 | ECPoint neg = p.Negate();
21 | ECPoint R = p;
22 |
23 | for (int i = h.BitLength - 2; i > 0; --i)
24 | {
25 | R = R.Twice();
26 |
27 | bool hBit = h.TestBit(i);
28 | bool eBit = e.TestBit(i);
29 |
30 | if (hBit != eBit)
31 | {
32 | R = R.Add(hBit ? p : neg);
33 | }
34 | }
35 |
36 | return R;
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/math/ec/multiplier/PreCompInfo.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Math.EC.Multiplier
2 | {
3 | /**
4 | * Interface for classes storing precomputation data for multiplication
5 | * algorithms. Used as a Memento (see GOF patterns) for
6 | * WNafMultiplier
.
7 | */
8 | internal interface PreCompInfo
9 | {
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/math/ec/multiplier/ReferenceMultiplier.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Math.EC.Multiplier
2 | {
3 | internal class ReferenceMultiplier
4 | : ECMultiplier
5 | {
6 | /**
7 | * Simple shift-and-add multiplication. Serves as reference implementation
8 | * to verify (possibly faster) implementations in
9 | * {@link org.bouncycastle.math.ec.ECPoint ECPoint}.
10 | *
11 | * @param p The point to multiply.
12 | * @param k The factor by which to multiply.
13 | * @return The result of the point multiplication k * p
.
14 | */
15 | public ECPoint Multiply(ECPoint p, BigInteger k, PreCompInfo preCompInfo)
16 | {
17 | ECPoint q = p.Curve.Infinity;
18 | int t = k.BitLength;
19 | for (int i = 0; i < t; i++)
20 | {
21 | if (k.TestBit(i))
22 | {
23 | q = q.Add(p);
24 | }
25 | p = p.Twice();
26 | }
27 | return q;
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/ocsp/CertificateStatus.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Ocsp
4 | {
5 | public abstract class CertificateStatus
6 | {
7 | public static readonly CertificateStatus Good = null;
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/ocsp/OCSPException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Ocsp
4 | {
5 | public class OcspException
6 | : Exception
7 | {
8 | public OcspException()
9 | {
10 | }
11 |
12 | public OcspException(
13 | string message)
14 | : base(message)
15 | {
16 | }
17 |
18 | public OcspException(
19 | string message,
20 | Exception e)
21 | : base(message, e)
22 | {
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/ocsp/OCSPRespStatus.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Ocsp
4 | {
5 | [Obsolete("Use version with correct spelling 'OcspRespStatus'")]
6 | public abstract class OcscpRespStatus : OcspRespStatus
7 | {
8 | }
9 |
10 | public abstract class OcspRespStatus
11 | {
12 | /**
13 | * note 4 is not used.
14 | */
15 | public const int Successful = 0; // --Response has valid confirmations
16 | public const int MalformedRequest = 1; // --Illegal confirmation request
17 | public const int InternalError = 2; // --Internal error in issuer
18 | public const int TryLater = 3; // --Try again later
19 | public const int SigRequired = 5; // --Must sign the request
20 | public const int Unauthorized = 6; // --Request unauthorized
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/ocsp/Req.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.IO;
4 |
5 | using Org.BouncyCastle.Asn1;
6 | using Org.BouncyCastle.Asn1.Ocsp;
7 | using Org.BouncyCastle.Asn1.X509;
8 | using Org.BouncyCastle.X509;
9 |
10 | namespace Org.BouncyCastle.Ocsp
11 | {
12 | public class Req
13 | : X509ExtensionBase
14 | {
15 | private Request req;
16 |
17 | public Req(
18 | Request req)
19 | {
20 | this.req = req;
21 | }
22 |
23 | public CertificateID GetCertID()
24 | {
25 | return new CertificateID(req.ReqCert);
26 | }
27 |
28 | public X509Extensions SingleRequestExtensions
29 | {
30 | get { return req.SingleRequestExtensions; }
31 | }
32 |
33 | protected override X509Extensions GetX509Extensions()
34 | {
35 | return SingleRequestExtensions;
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/ocsp/UnknownStatus.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Ocsp
4 | {
5 | /**
6 | * wrapper for the UnknownInfo object
7 | */
8 | public class UnknownStatus
9 | : CertificateStatus
10 | {
11 | public UnknownStatus()
12 | {
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/openpgp/IStreamGenerator.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Bcpg.OpenPgp
2 | {
3 | public interface IStreamGenerator
4 | {
5 | void Close();
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/openpgp/PGPObject.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Bcpg.OpenPgp
2 | {
3 | public abstract class PgpObject
4 | {
5 | internal PgpObject()
6 | {
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/openpgp/PGPUserAttributeSubpacketVectorGenerator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 |
4 | using Org.BouncyCastle.Bcpg.Attr;
5 | using Org.BouncyCastle.Utilities;
6 |
7 | namespace Org.BouncyCastle.Bcpg.OpenPgp
8 | {
9 | public class PgpUserAttributeSubpacketVectorGenerator
10 | {
11 | private IList list = Platform.CreateArrayList();
12 |
13 | public virtual void SetImageAttribute(
14 | ImageAttrib.Format imageType,
15 | byte[] imageData)
16 | {
17 | if (imageData == null)
18 | throw new ArgumentException("attempt to set null image", "imageData");
19 |
20 | list.Add(new ImageAttrib(imageType, imageData));
21 | }
22 |
23 | public virtual PgpUserAttributeSubpacketVector Generate()
24 | {
25 | UserAttributeSubpacket[] a = new UserAttributeSubpacket[list.Count];
26 | for (int i = 0; i < list.Count; ++i)
27 | {
28 | a[i] = (UserAttributeSubpacket)list[i];
29 | }
30 | return new PgpUserAttributeSubpacketVector(a);
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/openpgp/PgpDataValidationException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Bcpg.OpenPgp
4 | {
5 | ///
6 | /// Thrown if the IV at the start of a data stream indicates the wrong key is being used.
7 | ///
8 | public class PgpDataValidationException
9 | : PgpException
10 | {
11 | public PgpDataValidationException() : base() {}
12 | public PgpDataValidationException(string message) : base(message) {}
13 | public PgpDataValidationException(string message, Exception exception) : base(message, exception) {}
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/openpgp/PgpException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Bcpg.OpenPgp
4 | {
5 | /// Generic exception class for PGP encoding/decoding problems.
6 | public class PgpException
7 | : Exception
8 | {
9 | public PgpException() : base() {}
10 | public PgpException(string message) : base(message) {}
11 | public PgpException(string message, Exception exception) : base(message, exception) {}
12 |
13 | [Obsolete("Use InnerException property")]
14 | public Exception UnderlyingException
15 | {
16 | get { return InnerException; }
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/openpgp/PgpExperimental.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Bcpg.OpenPgp
4 | {
5 | public class PgpExperimental
6 | : PgpObject
7 | {
8 | private readonly ExperimentalPacket p;
9 |
10 | public PgpExperimental(
11 | BcpgInputStream bcpgIn)
12 | {
13 | p = (ExperimentalPacket) bcpgIn.ReadPacket();
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/openpgp/PgpKeyFlags.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Bcpg.OpenPgp
2 | {
3 | /// Key flag values for the KeyFlags subpacket.
4 | public abstract class PgpKeyFlags
5 | {
6 | public const int CanCertify = 0x01; // This key may be used to certify other keys.
7 | public const int CanSign = 0x02; // This key may be used to sign data.
8 | public const int CanEncryptCommunications = 0x04; // This key may be used to encrypt communications.
9 | public const int CanEncryptStorage = 0x08; // This key may be used to encrypt storage.
10 | public const int MaybeSplit = 0x10; // The private component of this key may have been split by a secret-sharing mechanism.
11 | public const int MaybeShared = 0x80; // The private component of this key may be in the possession of more than one person.
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/openpgp/PgpKeyValidationException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Bcpg.OpenPgp
4 | {
5 | ///
6 | /// Thrown if the key checksum is invalid.
7 | ///
8 | public class PgpKeyValidationException
9 | : PgpException
10 | {
11 | public PgpKeyValidationException() : base() {}
12 | public PgpKeyValidationException(string message) : base(message) {}
13 | public PgpKeyValidationException(string message, Exception exception) : base(message, exception) {}
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/openpgp/PgpMarker.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Bcpg.OpenPgp
2 | {
3 | ///
4 | /// A PGP marker packet - in general these should be ignored other than where
5 | /// the idea is to preserve the original input stream.
6 | ///
7 | public class PgpMarker
8 | : PgpObject
9 | {
10 | private readonly MarkerPacket p;
11 |
12 | public PgpMarker(
13 | BcpgInputStream bcpgIn)
14 | {
15 | p = (MarkerPacket) bcpgIn.ReadPacket();
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/openpgp/WrappedGeneratorStream.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 |
3 | using Org.BouncyCastle.Asn1.Utilities;
4 |
5 | namespace Org.BouncyCastle.Bcpg.OpenPgp
6 | {
7 | public class WrappedGeneratorStream
8 | : FilterStream
9 | {
10 | private readonly IStreamGenerator gen;
11 |
12 | public WrappedGeneratorStream(
13 | IStreamGenerator gen,
14 | Stream str)
15 | : base(str)
16 | {
17 | this.gen = gen;
18 | }
19 |
20 | public override void Close()
21 | {
22 | gen.Close();
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/openssl/EncryptionException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | namespace Org.BouncyCastle.Security
5 | {
6 | public class EncryptionException
7 | : IOException
8 | {
9 | public EncryptionException(
10 | string message)
11 | : base(message)
12 | {
13 | }
14 |
15 | public EncryptionException(
16 | string message,
17 | Exception exception)
18 | : base(message, exception)
19 | {
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/openssl/IPasswordFinder.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.OpenSsl
4 | {
5 | public interface IPasswordFinder
6 | {
7 | char[] GetPassword();
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/openssl/PEMException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | namespace Org.BouncyCastle.OpenSsl
5 | {
6 | public class PemException
7 | : IOException
8 | {
9 | public PemException(
10 | string message)
11 | : base(message)
12 | {
13 | }
14 |
15 | public PemException(
16 | string message,
17 | Exception exception)
18 | : base(message, exception)
19 | {
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/openssl/PasswordException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | namespace Org.BouncyCastle.Security
5 | {
6 | public class PasswordException
7 | : IOException
8 | {
9 | public PasswordException(
10 | string message)
11 | : base(message)
12 | {
13 | }
14 |
15 | public PasswordException(
16 | string message,
17 | Exception exception)
18 | : base(message, exception)
19 | {
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/pkcs/PKCS12StoreBuilder.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Org.BouncyCastle.Asn1;
4 | using Org.BouncyCastle.Asn1.Pkcs;
5 |
6 | namespace Org.BouncyCastle.Pkcs
7 | {
8 | public class Pkcs12StoreBuilder
9 | {
10 | private DerObjectIdentifier keyAlgorithm = PkcsObjectIdentifiers.PbeWithShaAnd3KeyTripleDesCbc;
11 | private DerObjectIdentifier certAlgorithm = PkcsObjectIdentifiers.PbewithShaAnd40BitRC2Cbc;
12 | private bool useDerEncoding = false;
13 |
14 | public Pkcs12StoreBuilder()
15 | {
16 | }
17 |
18 | public Pkcs12Store Build()
19 | {
20 | return new Pkcs12Store(keyAlgorithm, certAlgorithm, useDerEncoding);
21 | }
22 |
23 | public Pkcs12StoreBuilder SetCertAlgorithm(DerObjectIdentifier certAlgorithm)
24 | {
25 | this.certAlgorithm = certAlgorithm;
26 | return this;
27 | }
28 |
29 | public Pkcs12StoreBuilder SetKeyAlgorithm(DerObjectIdentifier keyAlgorithm)
30 | {
31 | this.keyAlgorithm = keyAlgorithm;
32 | return this;
33 | }
34 |
35 | public Pkcs12StoreBuilder SetUseDerEncoding(bool useDerEncoding)
36 | {
37 | this.useDerEncoding = useDerEncoding;
38 | return this;
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/pkix/CertStatus.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Org.BouncyCastle.Utilities.Date;
4 |
5 | namespace Org.BouncyCastle.Pkix
6 | {
7 | public class CertStatus
8 | {
9 | public const int Unrevoked = 11;
10 |
11 | public const int Undetermined = 12;
12 |
13 | private int status = Unrevoked;
14 |
15 | DateTimeObject revocationDate = null;
16 |
17 | ///
18 | /// Returns the revocationDate.
19 | ///
20 | public DateTimeObject RevocationDate
21 | {
22 | get { return revocationDate; }
23 | set { this.revocationDate = value; }
24 | }
25 |
26 | ///
27 | /// Returns the certStatus.
28 | ///
29 | public int Status
30 | {
31 | get { return status; }
32 | set { this.status = value; }
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/pkix/PkixCertPathBuilderException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Org.BouncyCastle.Security;
4 |
5 | namespace Org.BouncyCastle.Pkix
6 | {
7 | ///
8 | /// Summary description for PkixCertPathBuilderException.
9 | ///
10 | public class PkixCertPathBuilderException : GeneralSecurityException
11 | {
12 | public PkixCertPathBuilderException() : base() { }
13 |
14 | public PkixCertPathBuilderException(string message) : base(message) { }
15 |
16 | public PkixCertPathBuilderException(string message, Exception exception) : base(message, exception) { }
17 |
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/pkix/PkixNameConstraintValidatorException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Pkix
4 | {
5 | public class PkixNameConstraintValidatorException : Exception
6 | {
7 | public PkixNameConstraintValidatorException(String msg)
8 | : base(msg)
9 | {
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/security/GeneralSecurityException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Security
4 | {
5 | public class GeneralSecurityException
6 | : Exception
7 | {
8 | public GeneralSecurityException()
9 | : base()
10 | {
11 | }
12 |
13 | public GeneralSecurityException(
14 | string message)
15 | : base(message)
16 | {
17 | }
18 |
19 | public GeneralSecurityException(
20 | string message,
21 | Exception exception)
22 | : base(message, exception)
23 | {
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/security/InvalidKeyException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Security
4 | {
5 | public class InvalidKeyException : KeyException
6 | {
7 | public InvalidKeyException() : base() { }
8 | public InvalidKeyException(string message) : base(message) { }
9 | public InvalidKeyException(string message, Exception exception) : base(message, exception) { }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/security/InvalidParameterException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Security
4 | {
5 | public class InvalidParameterException : KeyException
6 | {
7 | public InvalidParameterException() : base() { }
8 | public InvalidParameterException(string message) : base(message) { }
9 | public InvalidParameterException(string message, Exception exception) : base(message, exception) { }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/security/KeyException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Security
4 | {
5 | public class KeyException : GeneralSecurityException
6 | {
7 | public KeyException() : base() { }
8 | public KeyException(string message) : base(message) { }
9 | public KeyException(string message, Exception exception) : base(message, exception) { }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/security/NoSuchAlgorithmException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Security
4 | {
5 | [Obsolete("Never thrown")]
6 | public class NoSuchAlgorithmException : GeneralSecurityException
7 | {
8 | public NoSuchAlgorithmException() : base() {}
9 | public NoSuchAlgorithmException(string message) : base(message) {}
10 | public NoSuchAlgorithmException(string message, Exception exception) : base(message, exception) {}
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/security/SecurityUtilityException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Security
4 | {
5 | public class SecurityUtilityException
6 | : Exception
7 | {
8 | /**
9 | * base constructor.
10 | */
11 | public SecurityUtilityException()
12 | {
13 | }
14 |
15 | /**
16 | * create a SecurityUtilityException with the given message.
17 | *
18 | * @param message the message to be carried with the exception.
19 | */
20 | public SecurityUtilityException(
21 | string message)
22 | : base(message)
23 | {
24 | }
25 |
26 | public SecurityUtilityException(
27 | string message,
28 | Exception exception)
29 | : base(message, exception)
30 | {
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/security/SignatureException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Security
4 | {
5 | public class SignatureException : GeneralSecurityException
6 | {
7 | public SignatureException() : base() { }
8 | public SignatureException(string message) : base(message) { }
9 | public SignatureException(string message, Exception exception) : base(message, exception) { }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/security/cert/CertificateEncodingException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Security.Certificates
4 | {
5 | public class CertificateEncodingException : CertificateException
6 | {
7 | public CertificateEncodingException() : base() { }
8 | public CertificateEncodingException(string msg) : base(msg) { }
9 | public CertificateEncodingException(string msg, Exception e) : base(msg, e) { }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/security/cert/CertificateException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Security.Certificates
4 | {
5 | public class CertificateException : GeneralSecurityException
6 | {
7 | public CertificateException() : base() { }
8 | public CertificateException(string message) : base(message) { }
9 | public CertificateException(string message, Exception exception) : base(message, exception) { }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/security/cert/CertificateExpiredException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Security.Certificates
4 | {
5 | public class CertificateExpiredException : CertificateException
6 | {
7 | public CertificateExpiredException() : base() { }
8 | public CertificateExpiredException(string message) : base(message) { }
9 | public CertificateExpiredException(string message, Exception exception) : base(message, exception) { }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/security/cert/CertificateNotYetValidException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Security.Certificates
4 | {
5 | public class CertificateNotYetValidException : CertificateException
6 | {
7 | public CertificateNotYetValidException() : base() { }
8 | public CertificateNotYetValidException(string message) : base(message) { }
9 | public CertificateNotYetValidException(string message, Exception exception) : base(message, exception) { }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/security/cert/CertificateParsingException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Security.Certificates
4 | {
5 | public class CertificateParsingException : CertificateException
6 | {
7 | public CertificateParsingException() : base() { }
8 | public CertificateParsingException(string message) : base(message) { }
9 | public CertificateParsingException(string message, Exception exception) : base(message, exception) { }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/security/cert/CrlException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Security.Certificates
4 | {
5 | public class CrlException : GeneralSecurityException
6 | {
7 | public CrlException() : base() { }
8 | public CrlException(string msg) : base(msg) {}
9 | public CrlException(string msg, Exception e) : base(msg, e) {}
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/tsp/GenTimeAccuracy.cs:
--------------------------------------------------------------------------------
1 | using Org.BouncyCastle.Asn1;
2 | using Org.BouncyCastle.Asn1.Tsp;
3 |
4 | namespace Org.BouncyCastle.Tsp
5 | {
6 | public class GenTimeAccuracy
7 | {
8 | private Accuracy accuracy;
9 |
10 | public GenTimeAccuracy(
11 | Accuracy accuracy)
12 | {
13 | this.accuracy = accuracy;
14 | }
15 |
16 | public int Seconds { get { return GetTimeComponent(accuracy.Seconds); } }
17 |
18 | public int Millis { get { return GetTimeComponent(accuracy.Millis); } }
19 |
20 | public int Micros { get { return GetTimeComponent(accuracy.Micros); } }
21 |
22 | private int GetTimeComponent(
23 | DerInteger time)
24 | {
25 | return time == null ? 0 : time.Value.IntValue;
26 | }
27 |
28 | public override string ToString()
29 | {
30 | return Seconds + "." + Millis.ToString("000") + Micros.ToString("000");
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/tsp/TSPException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Tsp
4 | {
5 | public class TspException
6 | : Exception
7 | {
8 | public TspException()
9 | {
10 | }
11 |
12 | public TspException(
13 | string message)
14 | : base(message)
15 | {
16 | }
17 |
18 | public TspException(
19 | string message,
20 | Exception e)
21 | : base(message, e)
22 | {
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/tsp/TSPValidationException.cs:
--------------------------------------------------------------------------------
1 | namespace Org.BouncyCastle.Tsp
2 | {
3 | /**
4 | * Exception thrown if a TSP request or response fails to validate.
5 | *
6 | * If a failure code is assciated with the exception it can be retrieved using
7 | * the getFailureCode() method.
8 | */
9 | public class TspValidationException
10 | : TspException
11 | {
12 | private int failureCode;
13 |
14 | public TspValidationException(
15 | string message)
16 | : base(message)
17 | {
18 | this.failureCode = -1;
19 | }
20 |
21 | public TspValidationException(
22 | string message,
23 | int failureCode)
24 | : base(message)
25 | {
26 | this.failureCode = failureCode;
27 | }
28 |
29 | /**
30 | * Return the failure code associated with this exception - if one is set.
31 | *
32 | * @return the failure code if set, -1 otherwise.
33 | */
34 | public int FailureCode
35 | {
36 | get { return failureCode; }
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/util/collections/EmptyEnumerable.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 |
4 | namespace Org.BouncyCastle.Utilities.Collections
5 | {
6 | public sealed class EmptyEnumerable
7 | : IEnumerable
8 | {
9 | public static readonly IEnumerable Instance = new EmptyEnumerable();
10 |
11 | private EmptyEnumerable()
12 | {
13 | }
14 |
15 | public IEnumerator GetEnumerator()
16 | {
17 | return EmptyEnumerator.Instance;
18 | }
19 | }
20 |
21 | public sealed class EmptyEnumerator
22 | : IEnumerator
23 | {
24 | public static readonly IEnumerator Instance = new EmptyEnumerator();
25 |
26 | private EmptyEnumerator()
27 | {
28 | }
29 |
30 | public bool MoveNext()
31 | {
32 | return false;
33 | }
34 |
35 | public void Reset()
36 | {
37 | }
38 |
39 | public object Current
40 | {
41 | get { throw new InvalidOperationException("No elements"); }
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/util/collections/EnumerableProxy.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 |
4 | namespace Org.BouncyCastle.Utilities.Collections
5 | {
6 | public sealed class EnumerableProxy
7 | : IEnumerable
8 | {
9 | private readonly IEnumerable inner;
10 |
11 | public EnumerableProxy(
12 | IEnumerable inner)
13 | {
14 | if (inner == null)
15 | throw new ArgumentNullException("inner");
16 |
17 | this.inner = inner;
18 | }
19 |
20 | public IEnumerator GetEnumerator()
21 | {
22 | return inner.GetEnumerator();
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/util/collections/ISet.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 |
4 | namespace Org.BouncyCastle.Utilities.Collections
5 | {
6 | public interface ISet
7 | : ICollection
8 | {
9 | void Add(object o);
10 | void AddAll(IEnumerable e);
11 | void Clear();
12 | bool Contains(object o);
13 | bool IsEmpty { get; }
14 | bool IsFixedSize { get; }
15 | bool IsReadOnly { get; }
16 | void Remove(object o);
17 | void RemoveAll(IEnumerable e);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/util/date/DateTimeObject.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Utilities.Date
4 | {
5 | public sealed class DateTimeObject
6 | {
7 | private readonly DateTime dt;
8 |
9 | public DateTimeObject(
10 | DateTime dt)
11 | {
12 | this.dt = dt;
13 | }
14 |
15 | public DateTime Value
16 | {
17 | get { return dt; }
18 | }
19 |
20 | public override string ToString()
21 | {
22 | return dt.ToString();
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/util/encoders/IEncoder.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | namespace Org.BouncyCastle.Utilities.Encoders
5 | {
6 | /**
7 | * Encode and decode byte arrays (typically from binary to 7-bit ASCII
8 | * encodings).
9 | */
10 | public interface IEncoder
11 | {
12 | int Encode(byte[] data, int off, int length, Stream outStream);
13 |
14 | int Decode(byte[] data, int off, int length, Stream outStream);
15 |
16 | int DecodeString(string data, Stream outStream);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/util/encoders/Translator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Utilities.Encoders
4 | {
5 | ///
6 | /// Translator interface.
7 | ///
8 | public interface ITranslator
9 | {
10 | int GetEncodedBlockSize();
11 |
12 | int Encode(byte[] input, int inOff, int length, byte[] outBytes, int outOff);
13 |
14 | int GetDecodedBlockSize();
15 |
16 | int Decode(byte[] input, int inOff, int length, byte[] outBytes, int outOff);
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/util/io/PushbackStream.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | using Org.BouncyCastle.Asn1.Utilities;
5 |
6 | namespace Org.BouncyCastle.Utilities.IO
7 | {
8 | public class PushbackStream
9 | : FilterStream
10 | {
11 | private int buf = -1;
12 |
13 | public PushbackStream(
14 | Stream s)
15 | : base(s)
16 | {
17 | }
18 |
19 | public override int ReadByte()
20 | {
21 | if (buf != -1)
22 | {
23 | int tmp = buf;
24 | buf = -1;
25 | return tmp;
26 | }
27 |
28 | return base.ReadByte();
29 | }
30 |
31 | public override int Read(byte[] buffer, int offset, int count)
32 | {
33 | if (buf != -1 && count > 0)
34 | {
35 | // TODO Can this case be made more efficient?
36 | buffer[offset] = (byte) buf;
37 | buf = -1;
38 | return 1;
39 | }
40 |
41 | return base.Read(buffer, offset, count);
42 | }
43 |
44 | public virtual void Unread(int b)
45 | {
46 | if (buf != -1)
47 | throw new InvalidOperationException("Can only push back one byte");
48 |
49 | buf = b & 0xFF;
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/util/io/StreamOverflowException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | namespace Org.BouncyCastle.Utilities.IO
5 | {
6 | public class StreamOverflowException
7 | : IOException
8 | {
9 | public StreamOverflowException()
10 | : base()
11 | {
12 | }
13 |
14 | public StreamOverflowException(
15 | string message)
16 | : base(message)
17 | {
18 | }
19 |
20 | public StreamOverflowException(
21 | string message,
22 | Exception exception)
23 | : base(message, exception)
24 | {
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/util/io/TeeInputStream.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.IO;
4 |
5 | namespace Org.BouncyCastle.Utilities.IO
6 | {
7 | public class TeeInputStream
8 | : BaseInputStream
9 | {
10 | private readonly Stream input, tee;
11 |
12 | public TeeInputStream(Stream input, Stream tee)
13 | {
14 | Debug.Assert(input.CanRead);
15 | Debug.Assert(tee.CanWrite);
16 |
17 | this.input = input;
18 | this.tee = tee;
19 | }
20 |
21 | public override void Close()
22 | {
23 | input.Close();
24 | tee.Close();
25 | }
26 |
27 | public override int Read(byte[] buf, int off, int len)
28 | {
29 | int i = input.Read(buf, off, len);
30 |
31 | if (i > 0)
32 | {
33 | tee.Write(buf, off, i);
34 | }
35 |
36 | return i;
37 | }
38 |
39 | public override int ReadByte()
40 | {
41 | int i = input.ReadByte();
42 |
43 | if (i >= 0)
44 | {
45 | tee.WriteByte((byte)i);
46 | }
47 |
48 | return i;
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/util/io/TeeOutputStream.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.IO;
4 |
5 | namespace Org.BouncyCastle.Utilities.IO
6 | {
7 | public class TeeOutputStream
8 | : BaseOutputStream
9 | {
10 | private readonly Stream output, tee;
11 |
12 | public TeeOutputStream(Stream output, Stream tee)
13 | {
14 | Debug.Assert(output.CanWrite);
15 | Debug.Assert(tee.CanWrite);
16 |
17 | this.output = output;
18 | this.tee = tee;
19 | }
20 |
21 | public override void Close()
22 | {
23 | output.Close();
24 | tee.Close();
25 | }
26 |
27 | public override void Write(byte[] buffer, int offset, int count)
28 | {
29 | output.Write(buffer, offset, count);
30 | tee.Write(buffer, offset, count);
31 | }
32 |
33 | public override void WriteByte(byte b)
34 | {
35 | output.WriteByte(b);
36 | tee.WriteByte(b);
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/util/io/pem/PemGenerationException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Utilities.IO.Pem
4 | {
5 | public class PemGenerationException
6 | : Exception
7 | {
8 | public PemGenerationException()
9 | : base()
10 | {
11 | }
12 |
13 | public PemGenerationException(
14 | string message)
15 | : base(message)
16 | {
17 | }
18 |
19 | public PemGenerationException(
20 | string message,
21 | Exception exception)
22 | : base(message, exception)
23 | {
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/util/io/pem/PemHeader.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Utilities.IO.Pem
4 | {
5 | public class PemHeader
6 | {
7 | private string name;
8 | private string val;
9 |
10 | public PemHeader(string name, string val)
11 | {
12 | this.name = name;
13 | this.val = val;
14 | }
15 |
16 | public virtual string Name
17 | {
18 | get { return name; }
19 | }
20 |
21 | public virtual string Value
22 | {
23 | get { return val; }
24 | }
25 |
26 | public override int GetHashCode()
27 | {
28 | return GetHashCode(this.name) + 31 * GetHashCode(this.val);
29 | }
30 |
31 | public override bool Equals(object obj)
32 | {
33 | if (obj == this)
34 | return true;
35 |
36 | if (!(obj is PemHeader))
37 | return false;
38 |
39 | PemHeader other = (PemHeader)obj;
40 |
41 | return Platform.Equals(this.name, other.name)
42 | && Platform.Equals(this.val, other.val);
43 | }
44 |
45 | private int GetHashCode(string s)
46 | {
47 | if (s == null)
48 | {
49 | return 1;
50 | }
51 |
52 | return s.GetHashCode();
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/util/io/pem/PemObject.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 |
4 | using Org.BouncyCastle.Utilities.Collections;
5 |
6 | namespace Org.BouncyCastle.Utilities.IO.Pem
7 | {
8 | public class PemObject
9 | : PemObjectGenerator
10 | {
11 | private string type;
12 | private IList headers;
13 | private byte[] content;
14 |
15 | public PemObject(string type, byte[] content)
16 | : this(type, Platform.CreateArrayList(), content)
17 | {
18 | }
19 |
20 | public PemObject(String type, IList headers, byte[] content)
21 | {
22 | this.type = type;
23 | this.headers = Platform.CreateArrayList(headers);
24 | this.content = content;
25 | }
26 |
27 | public string Type
28 | {
29 | get { return type; }
30 | }
31 |
32 | public IList Headers
33 | {
34 | get { return headers; }
35 | }
36 |
37 | public byte[] Content
38 | {
39 | get { return content; }
40 | }
41 |
42 | public PemObject Generate()
43 | {
44 | return this;
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/util/io/pem/PemObjectGenerator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.Utilities.IO.Pem
4 | {
5 | public interface PemObjectGenerator
6 | {
7 | ///
8 | /// A
9 | ///
10 | ///
11 | PemObject Generate();
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/util/io/pem/PemObjectParser.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | namespace Org.BouncyCastle.Utilities.IO.Pem
5 | {
6 | public interface PemObjectParser
7 | {
8 | ///
9 | /// A
10 | ///
11 | ///
12 | /// A
13 | ///
14 | ///
15 | object ParseObject(PemObject obj);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/x509/IX509Extension.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | using Org.BouncyCastle.Asn1;
4 | using Org.BouncyCastle.Utilities.Collections;
5 |
6 | namespace Org.BouncyCastle.X509
7 | {
8 | public interface IX509Extension
9 | {
10 | ///
11 | /// Get all critical extension values, by oid
12 | ///
13 | /// IDictionary with string (OID) keys and Asn1OctetString values
14 | ISet GetCriticalExtensionOids();
15 |
16 | ///
17 | /// Get all non-critical extension values, by oid
18 | ///
19 | /// IDictionary with string (OID) keys and Asn1OctetString values
20 | ISet GetNonCriticalExtensionOids();
21 |
22 | [Obsolete("Use version taking a DerObjectIdentifier instead")]
23 | Asn1OctetString GetExtensionValue(string oid);
24 |
25 | Asn1OctetString GetExtensionValue(DerObjectIdentifier oid);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/x509/store/IX509Selector.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.X509.Store
4 | {
5 | public interface IX509Selector
6 | #if !SILVERLIGHT
7 | : ICloneable
8 | #endif
9 | {
10 | #if SILVERLIGHT
11 | object Clone();
12 | #endif
13 | bool Match(object obj);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/x509/store/IX509Store.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 |
4 | namespace Org.BouncyCastle.X509.Store
5 | {
6 | public interface IX509Store
7 | {
8 | // void Init(IX509StoreParameters parameters);
9 | ICollection GetMatches(IX509Selector selector);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/x509/store/IX509StoreParameters.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.X509.Store
4 | {
5 | public interface IX509StoreParameters
6 | {
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/x509/store/NoSuchStoreException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.X509.Store
4 | {
5 | public class NoSuchStoreException
6 | : X509StoreException
7 | {
8 | public NoSuchStoreException()
9 | {
10 | }
11 |
12 | public NoSuchStoreException(
13 | string message)
14 | : base(message)
15 | {
16 | }
17 |
18 | public NoSuchStoreException(
19 | string message,
20 | Exception e)
21 | : base(message, e)
22 | {
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/BountyCastle/x509/store/X509StoreException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Org.BouncyCastle.X509.Store
4 | {
5 | public class X509StoreException
6 | : Exception
7 | {
8 | public X509StoreException()
9 | {
10 | }
11 |
12 | public X509StoreException(
13 | string message)
14 | : base(message)
15 | {
16 | }
17 |
18 | public X509StoreException(
19 | string message,
20 | Exception e)
21 | : base(message, e)
22 | {
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/NntpClientLib/ArticleBodyTextCollection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace NntpClientLib
5 | {
6 | public class ArticleBodyTextCollection : List, IArticleBodyProcessor
7 | {
8 | #region IArticleBodyProcessor Members
9 |
10 | ///
11 | /// Adds the text.
12 | ///
13 | /// The line.
14 | public void AddText(string line)
15 | {
16 | Add(line);
17 |
18 | }
19 | /*
20 | public void SetCapacity(int value)
21 | {
22 | Capacity = value;
23 | }
24 | */
25 |
26 | #endregion
27 | }
28 |
29 |
30 |
31 | }
32 |
33 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/NntpClientLib/IArticleBodyProcessor.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace NntpClientLib
4 | {
5 | public interface IArticleBodyProcessor
6 | {
7 | ///
8 | /// Adds the text.
9 | ///
10 | /// The line.
11 | void AddText(string line);
12 |
13 | //void SetCapacity(int count);
14 | }
15 | }
16 |
17 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/NntpClientLib/IArticleHeaderEnumerator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace NntpClientLib
6 | {
7 | public interface IArticleHeaderEnumerator
8 | {
9 | ///
10 | /// Gets the header keys.
11 | ///
12 | /// The header keys.
13 | IEnumerable HeaderKeys { get; }
14 |
15 | ///
16 | /// Gets the with the specified header key.
17 | /// Each named header can potentially have multiple values, so we manage this with a list.
18 | ///
19 | ///
20 | IList this[string headerKey] { get; }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/NntpClientLib/IArticleHeadersProcessor.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace NntpClientLib
4 | {
5 | public interface IArticleHeadersProcessor
6 | {
7 | ///
8 | /// Adds the header.
9 | ///
10 | /// The header and value.
11 | void AddHeader(string headerAndValue);
12 |
13 | ///
14 | /// Adds the header.
15 | ///
16 | /// The header.
17 | /// The value.
18 | void AddHeader(string header, string value);
19 | }
20 | }
21 |
22 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/NntpClientLib/NntpGroupNotSelectedException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.Serialization;
3 |
4 | namespace NntpClientLib
5 | {
6 | //***[Serializable]
7 | public class NntpGroupNotSelectedException : NntpException
8 | {
9 | public NntpGroupNotSelectedException() { }
10 | public NntpGroupNotSelectedException(string message) : base(message) { }
11 | public NntpGroupNotSelectedException(string message, Exception inner) : base(message, inner) { }
12 | protected NntpGroupNotSelectedException(SerializationInfo info, StreamingContext context)
13 | : base(info, context) { }
14 | }
15 | }
16 |
17 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/NntpClientLib/Resource.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/retroplasma/binsync/0492f1c82f93740f76119a4a4cbed4cc2ffa958c/src/Binsync.Dependencies/NntpClientLib/Resource.resources
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/NntpClientLib/Rfc4643ResponseCodes.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace NntpClientLib
4 | {
5 | ///
6 | /// See http://tools.ietf.org/html/rfc4643 for more details of this.
7 | ///
8 | internal sealed class Rfc4643ResponseCodes
9 | {
10 | public const int AuthenticationAccepted = 281;
11 | public const int PasswordRequired = 381;
12 | public const int AuthenticationRequired = 480;
13 | public const int AuthenticationFailed = 481;
14 | public const int AuthenticationCommandsOutOfSequence = 482;
15 | public const int CommandUnavailable = 502;
16 | }
17 | }
18 |
19 |
--------------------------------------------------------------------------------
/src/Binsync.Dependencies/NntpClientLib/TimeZoneOption.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace NntpClientLib
4 | {
5 | public enum TimeZoneOption
6 | {
7 | None = 0, UseGreenwichMeanTime
8 | }
9 | }
10 |
11 |
--------------------------------------------------------------------------------
/src/Binsync.Tests/Binsync.Tests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp2.1
5 |
6 | false
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/src/Binsync.Tests/Hash.cs:
--------------------------------------------------------------------------------
1 | using NUnit.Framework;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using Binsync.Core;
6 | using Binsync.Core.Helpers;
7 |
8 | namespace Tests
9 | {
10 | public class HashTests
11 | {
12 |
13 | [SetUp]
14 | public void Setup()
15 | {
16 | }
17 |
18 | [Test]
19 | public static void TestHashBlock()
20 | {
21 | HashSet hashes = new HashSet();
22 | hashes.Add(new byte[] { }.SHA256().ToHexString());
23 | for (var i = 1; i <= 100; i++)
24 | {
25 | hashes.Add(Enumerable.Repeat(0, i).ToArray().SHA256().ToHexString());
26 | hashes.Add(Enumerable.Repeat(255, i).ToArray().SHA256().ToHexString());
27 | hashes.Add(Enumerable.Range(1, i).Select(x => (byte)x).ToArray().SHA256().ToHexString());
28 | hashes.Add(Enumerable.Range(2, i).Select(x => (byte)x).ToArray().SHA256().ToHexString());
29 | }
30 | Assert.AreEqual(401, hashes.Count);
31 | }
32 | }
33 | }
--------------------------------------------------------------------------------
/src/Binsync.Util/Binsync.Util.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/Binsync.Util/CommandLine.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Binsync.Core;
3 | using System.IO;
4 |
5 | namespace Binsync.Util
6 | {
7 | public class CommandLine
8 | {
9 | public static Config ConfigForMain(string[] args)
10 | {
11 | if (args.Length != 1)
12 | {
13 | Console.Error.WriteLine("Please specify path to config JSON file as argument.");
14 | Console.Error.WriteLine("Example config.json:");
15 | Console.WriteLine(Binsync.Util.Config.ExampleJSON(storageCodeText: Engine.Credentials.GenerateStorageCode()));
16 | return null;
17 | }
18 |
19 | if (args[0].ToLowerInvariant() == "gen")
20 | {
21 | Console.WriteLine("Storage Code: " + Engine.Credentials.GenerateStorageCode());
22 | return null;
23 | }
24 |
25 | return new Binsync.Util.Config(jsonFilePath: args[0]);
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Binsync.WebDavServer/Controllers/WebDavController.cs:
--------------------------------------------------------------------------------
1 | using FubarDev.WebDavServer;
2 | using FubarDev.WebDavServer.AspNetCore;
3 |
4 | using Microsoft.AspNetCore.Authorization;
5 | using Microsoft.AspNetCore.Mvc;
6 | using Microsoft.Extensions.Logging;
7 | using System.Threading;
8 | using System.Threading.Tasks;
9 |
10 | namespace Binsync.WebDavServer
11 | {
12 | [Route("_dav/{*path}")]
13 | [Authorize]
14 | public class WebDavController : WebDavControllerBase
15 | {
16 | public WebDavController(IWebDavContext context, IWebDavDispatcher dispatcher, ILogger responseLogger = null)
17 | : base(context, dispatcher, responseLogger)
18 | {
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Binsync.WebDavServer/Middlewares/ImpersonationMiddleware.cs:
--------------------------------------------------------------------------------
1 | using System.Security.Principal;
2 | using System.Threading.Tasks;
3 |
4 | using Microsoft.AspNetCore.Http;
5 |
6 | namespace Binsync.WebDavServer.Middlewares
7 | {
8 | public class ImpersonationMiddleware
9 | {
10 | private readonly RequestDelegate _next;
11 |
12 | public ImpersonationMiddleware(RequestDelegate next)
13 | {
14 | _next = next;
15 | }
16 |
17 | // ReSharper disable once UnusedMember.Local
18 | public async Task Invoke(HttpContext context)
19 | {
20 | if (!(context.User.Identity is WindowsIdentity identity) || !identity.IsAuthenticated)
21 | {
22 | await _next(context);
23 | }
24 | else
25 | {
26 | await WindowsIdentity.RunImpersonated(
27 | identity.AccessToken,
28 | async () => { await _next(context); });
29 | }
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/Binsync.WebDavServer/Properties/PublishProfiles/FileSystemProfile.pubxml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 | FileSystem
9 | FileSystem
10 | Release
11 | Any CPU
12 |
13 | True
14 | False
15 |
16 | bin\Release\PublishOutput
17 | False
18 |
19 |
--------------------------------------------------------------------------------
/src/Binsync.WebDavServer/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:14868/",
7 | "sslPort": 0
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "environmentVariables": {
14 | "ASPNETCORE_ENVIRONMENT": "Development"
15 | }
16 | },
17 | "Binsync.WebDavServer": {
18 | "commandName": "Project",
19 | "commandLineArgs": "--use-kestrel=true --Server:FileSystem=InMemory --Server:PropertyStore=InMemory --Server:LockManager=InMemory",
20 | "environmentVariables": {
21 | "ASPNETCORE_ENVIRONMENT": "Development"
22 | },
23 | "applicationUrl": "http://localhost:5809/"
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/src/Binsync.WebDavServer/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "IncludeScopes": true,
4 | "LogLevel": {
5 | "Default": "Information",
6 | "System": "Information",
7 | "Microsoft": "Information",
8 | "FubarDev.WebDavServer": "Trace",
9 | "FubarDev.WebDavServer.Handlers.Impl": "Trace",
10 | "FubarDev.WebDavServer.AspNetCore.WebDavIndirectResult": "Trace",
11 | "FubarDev.WebDavServer.Sample.AspNetCore.Startup.RequestLogMiddleware": "Trace"
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Binsync.WebDavServer/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "Host": {
3 | },
4 | "Logging": {
5 | "IncludeScopes": false,
6 | "Debug": {
7 | "LogLevel": {
8 | "Default": "Trace"
9 | }
10 | },
11 | "Console": {
12 | "LogLevel": {
13 | "Default": "Warning"
14 | }
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/Binsync.WebDavServer/web.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/src/Binsync.WebDavServer/wwwroot/images/header_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/retroplasma/binsync/0492f1c82f93740f76119a4a4cbed4cc2ffa958c/src/Binsync.WebDavServer/wwwroot/images/header_logo.png
--------------------------------------------------------------------------------