forked from sh377c0d3/Payloads
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
79 changed files
with
8,155 additions
and
0 deletions.
There are no files selected for viewing
78 changes: 78 additions & 0 deletions
78
Priviledge-Escalation/winPEAS/winPEASexe/winPEAS/3rdParty/BouncyCastle/asn1/Asn1Encodable.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
using System.IO; | ||
|
||
namespace winPEAS._3rdParty.BouncyCastle.asn1 | ||
{ | ||
public abstract class Asn1Encodable | ||
: IAsn1Convertible | ||
{ | ||
public const string Der = "DER"; | ||
public const string Ber = "BER"; | ||
|
||
public byte[] GetEncoded() | ||
{ | ||
MemoryStream bOut = new MemoryStream(); | ||
Asn1OutputStream aOut = new Asn1OutputStream(bOut); | ||
|
||
aOut.WriteObject(this); | ||
|
||
return bOut.ToArray(); | ||
} | ||
|
||
public byte[] GetEncoded( | ||
string encoding) | ||
{ | ||
if (encoding.Equals(Der)) | ||
{ | ||
MemoryStream bOut = new MemoryStream(); | ||
DerOutputStream dOut = new DerOutputStream(bOut); | ||
|
||
dOut.WriteObject(this); | ||
|
||
return bOut.ToArray(); | ||
} | ||
|
||
return GetEncoded(); | ||
} | ||
|
||
/** | ||
* Return the DER encoding of the object, null if the DER encoding can not be made. | ||
* | ||
* @return a DER byte array, null otherwise. | ||
*/ | ||
public byte[] GetDerEncoded() | ||
{ | ||
try | ||
{ | ||
return GetEncoded(Der); | ||
} | ||
catch (IOException) | ||
{ | ||
return null; | ||
} | ||
} | ||
|
||
public sealed override int GetHashCode() | ||
{ | ||
return ToAsn1Object().CallAsn1GetHashCode(); | ||
} | ||
|
||
public sealed override bool Equals( | ||
object obj) | ||
{ | ||
if (obj == this) | ||
return true; | ||
|
||
IAsn1Convertible other = obj as IAsn1Convertible; | ||
|
||
if (other == null) | ||
return false; | ||
|
||
Asn1Object o1 = ToAsn1Object(); | ||
Asn1Object o2 = other.ToAsn1Object(); | ||
|
||
return o1 == o2 || (null != o2 && o1.CallAsn1Equals(o2)); | ||
} | ||
|
||
public abstract Asn1Object ToAsn1Object(); | ||
} | ||
} |
191 changes: 191 additions & 0 deletions
191
...e-Escalation/winPEAS/winPEASexe/winPEAS/3rdParty/BouncyCastle/asn1/Asn1EncodableVector.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,191 @@ | ||
using System; | ||
using System.Collections; | ||
|
||
namespace winPEAS._3rdParty.BouncyCastle.asn1 | ||
{ | ||
/** | ||
* Mutable class for building ASN.1 constructed objects such as SETs or SEQUENCEs. | ||
*/ | ||
public class Asn1EncodableVector | ||
: IEnumerable | ||
{ | ||
internal static readonly Asn1Encodable[] EmptyElements = new Asn1Encodable[0]; | ||
|
||
private const int DefaultCapacity = 10; | ||
|
||
private Asn1Encodable[] elements; | ||
private int elementCount; | ||
private bool copyOnWrite; | ||
|
||
public static Asn1EncodableVector FromEnumerable(IEnumerable e) | ||
{ | ||
Asn1EncodableVector v = new Asn1EncodableVector(); | ||
foreach (Asn1Encodable obj in e) | ||
{ | ||
v.Add(obj); | ||
} | ||
return v; | ||
} | ||
|
||
public Asn1EncodableVector() | ||
: this(DefaultCapacity) | ||
{ | ||
} | ||
|
||
public Asn1EncodableVector(int initialCapacity) | ||
{ | ||
if (initialCapacity < 0) | ||
throw new ArgumentException("must not be negative", "initialCapacity"); | ||
|
||
this.elements = (initialCapacity == 0) ? EmptyElements : new Asn1Encodable[initialCapacity]; | ||
this.elementCount = 0; | ||
this.copyOnWrite = false; | ||
} | ||
|
||
public Asn1EncodableVector(params Asn1Encodable[] v) | ||
: this() | ||
{ | ||
Add(v); | ||
} | ||
|
||
public void Add(Asn1Encodable element) | ||
{ | ||
if (null == element) | ||
throw new ArgumentNullException("element"); | ||
|
||
int capacity = elements.Length; | ||
int minCapacity = elementCount + 1; | ||
if ((minCapacity > capacity) | copyOnWrite) | ||
{ | ||
Reallocate(minCapacity); | ||
} | ||
|
||
this.elements[elementCount] = element; | ||
this.elementCount = minCapacity; | ||
} | ||
|
||
public void Add(params Asn1Encodable[] objs) | ||
{ | ||
foreach (Asn1Encodable obj in objs) | ||
{ | ||
Add(obj); | ||
} | ||
} | ||
|
||
public void AddOptional(params Asn1Encodable[] objs) | ||
{ | ||
if (objs != null) | ||
{ | ||
foreach (Asn1Encodable obj in objs) | ||
{ | ||
if (obj != null) | ||
{ | ||
Add(obj); | ||
} | ||
} | ||
} | ||
} | ||
|
||
public void AddOptionalTagged(bool isExplicit, int tagNo, Asn1Encodable obj) | ||
{ | ||
if (null != obj) | ||
{ | ||
Add(new DerTaggedObject(isExplicit, tagNo, obj)); | ||
} | ||
} | ||
|
||
public void AddAll(Asn1EncodableVector other) | ||
{ | ||
if (null == other) | ||
throw new ArgumentNullException("other"); | ||
|
||
int otherElementCount = other.Count; | ||
if (otherElementCount < 1) | ||
return; | ||
|
||
int capacity = elements.Length; | ||
int minCapacity = elementCount + otherElementCount; | ||
if ((minCapacity > capacity) | copyOnWrite) | ||
{ | ||
Reallocate(minCapacity); | ||
} | ||
|
||
int i = 0; | ||
do | ||
{ | ||
Asn1Encodable otherElement = other[i]; | ||
if (null == otherElement) | ||
throw new NullReferenceException("'other' elements cannot be null"); | ||
|
||
this.elements[elementCount + i] = otherElement; | ||
} | ||
while (++i < otherElementCount); | ||
|
||
this.elementCount = minCapacity; | ||
} | ||
|
||
public Asn1Encodable this[int index] | ||
{ | ||
get | ||
{ | ||
if (index >= elementCount) | ||
throw new IndexOutOfRangeException(index + " >= " + elementCount); | ||
|
||
return elements[index]; | ||
} | ||
} | ||
|
||
public int Count | ||
{ | ||
get { return elementCount; } | ||
} | ||
|
||
public IEnumerator GetEnumerator() | ||
{ | ||
return CopyElements().GetEnumerator(); | ||
} | ||
|
||
internal Asn1Encodable[] CopyElements() | ||
{ | ||
if (0 == elementCount) | ||
return EmptyElements; | ||
|
||
Asn1Encodable[] copy = new Asn1Encodable[elementCount]; | ||
Array.Copy(elements, 0, copy, 0, elementCount); | ||
return copy; | ||
} | ||
|
||
internal Asn1Encodable[] TakeElements() | ||
{ | ||
if (0 == elementCount) | ||
return EmptyElements; | ||
|
||
if (elements.Length == elementCount) | ||
{ | ||
this.copyOnWrite = true; | ||
return elements; | ||
} | ||
|
||
Asn1Encodable[] copy = new Asn1Encodable[elementCount]; | ||
Array.Copy(elements, 0, copy, 0, elementCount); | ||
return copy; | ||
} | ||
|
||
private void Reallocate(int minCapacity) | ||
{ | ||
int oldCapacity = elements.Length; | ||
int newCapacity = System.Math.Max(oldCapacity, minCapacity + (minCapacity >> 1)); | ||
|
||
Asn1Encodable[] copy = new Asn1Encodable[newCapacity]; | ||
Array.Copy(elements, 0, copy, 0, elementCount); | ||
|
||
this.elements = copy; | ||
this.copyOnWrite = false; | ||
} | ||
|
||
internal static Asn1Encodable[] CloneElements(Asn1Encodable[] elements) | ||
{ | ||
return elements.Length < 1 ? EmptyElements : (Asn1Encodable[])elements.Clone(); | ||
} | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
Priviledge-Escalation/winPEAS/winPEASexe/winPEAS/3rdParty/BouncyCastle/asn1/Asn1Exception.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System; | ||
using System.IO; | ||
|
||
namespace winPEAS._3rdParty.BouncyCastle.asn1 | ||
{ | ||
#if !(NETCF_1_0 || NETCF_2_0 || SILVERLIGHT || PORTABLE) | ||
[Serializable] | ||
#endif | ||
public class Asn1Exception | ||
: IOException | ||
{ | ||
public Asn1Exception() | ||
: base() | ||
{ | ||
} | ||
|
||
public Asn1Exception( | ||
string message) | ||
: base(message) | ||
{ | ||
} | ||
|
||
public Asn1Exception( | ||
string message, | ||
Exception exception) | ||
: base(message, exception) | ||
{ | ||
} | ||
} | ||
} |
Oops, something went wrong.