This commit is contained in:
2026-06-15 18:18:16 +08:00
parent 97c9fba14e
commit 2b9f134e5f
4164 changed files with 386922 additions and 79 deletions

View File

@@ -0,0 +1,23 @@
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
#pragma warning disable
using System;
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Bcpg.Sig
{
/**
* Packet embedded signature
*/
public class EmbeddedSignature
: SignatureSubpacket
{
public EmbeddedSignature(
bool critical,
bool isLongLength,
byte[] data)
: base(SignatureSubpacketTag.EmbeddedSignature, critical, isLongLength, data)
{
}
}
}
#pragma warning restore
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 826ff03cd85cf9e48ae06cb9dc9aff70
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,40 @@
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
#pragma warning disable
using System;
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Bcpg.Sig
{
/**
* packet giving signature creation time.
*/
public class Exportable
: SignatureSubpacket
{
private static byte[] BooleanToByteArray(bool val)
{
return new byte[1]{ Convert.ToByte(val) };
}
public Exportable(
bool critical,
bool isLongLength,
byte[] data)
: base(SignatureSubpacketTag.Exportable, critical, isLongLength, data)
{
}
public Exportable(
bool critical,
bool isExportable)
: base(SignatureSubpacketTag.Exportable, critical, false, BooleanToByteArray(isExportable))
{
}
public bool IsExportable()
{
return data[0] != 0;
}
}
}
#pragma warning restore
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 581fe417e1b5a0a45ac67acb2e0efecd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,63 @@
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
#pragma warning disable
using System;
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Bcpg.Sig
{
/**
* packet giving signature expiration time.
*/
public class Features
: SignatureSubpacket
{
/** Identifier for the Modification Detection (packets 18 and 19) */
public static readonly byte FEATURE_MODIFICATION_DETECTION = 0x01;
/** Identifier for the AEAD Encrypted Data Packet (packet 20) and version 5
Symmetric-Key Encrypted Session Key Packets (packet 3) */
public static readonly byte FEATURE_AEAD_ENCRYPTED_DATA = 0x02;
/** Identifier for the Version 5 Public-Key Packet format and corresponding new
fingerprint format */
public static readonly byte FEATURE_VERSION_5_PUBLIC_KEY = 0x04;
private static byte[] FeatureToByteArray(byte feature)
{
return new byte[1]{ feature };
}
public Features(
bool critical,
bool isLongLength,
byte[] data)
: base(SignatureSubpacketTag.Features, critical, isLongLength, data)
{
}
public Features(bool critical, byte features): this(critical, false, FeatureToByteArray(features))
{
}
public Features(bool critical, int features): this(critical, false, FeatureToByteArray((byte)features))
{
}
/**
* Returns if modification detection is supported.
*/
public bool SupportsModificationDetection
{
get { return SupportsFeature(FEATURE_MODIFICATION_DETECTION); }
}
/**
* Returns if a particular feature is supported.
*/
public bool SupportsFeature(byte feature)
{
return (data[0] & feature) != 0;
}
}
}
#pragma warning restore
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2696c28036ba71a44a5bd4b7c8a9a4d2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,37 @@
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
#pragma warning disable
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Crypto.Utilities;
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Bcpg.Sig
{
/**
* packet giving signature creation time.
*/
public class IssuerKeyId
: SignatureSubpacket
{
protected static byte[] KeyIdToBytes(long keyId)
{
return Pack.UInt64_To_BE((ulong)keyId);
}
public IssuerKeyId(
bool critical,
bool isLongLength,
byte[] data)
: base(SignatureSubpacketTag.IssuerKeyId, critical, isLongLength, data)
{
}
public IssuerKeyId(
bool critical,
long keyId)
: base(SignatureSubpacketTag.IssuerKeyId, critical, false, KeyIdToBytes(keyId))
{
}
public long KeyId => (long)Pack.BE_To_UInt64(data);
}
}
#pragma warning restore
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 694260a3c3a2414409ca33e092da7b6a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,42 @@
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
#pragma warning disable
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Crypto.Utilities;
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Bcpg.Sig
{
/**
* packet giving time after creation at which the key expires.
*/
public class KeyExpirationTime
: SignatureSubpacket
{
protected static byte[] TimeToBytes(long t)
{
return Pack.UInt32_To_BE((uint)t);
}
public KeyExpirationTime(
bool critical,
bool isLongLength,
byte[] data)
: base(SignatureSubpacketTag.KeyExpireTime, critical, isLongLength, data)
{
}
public KeyExpirationTime(
bool critical,
long seconds)
: base(SignatureSubpacketTag.KeyExpireTime, critical, false, TimeToBytes(seconds))
{
}
/**
* Return the number of seconds after creation time a key is valid for.
*
* @return second count for key validity.
*/
public long Time => (long)Pack.BE_To_UInt32(data);
}
}
#pragma warning restore
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5549f1242cf947640b8fb17e7a0be5f0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,79 @@
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
#pragma warning disable
using System;
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Math;
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Bcpg.Sig
{
/**
* Packet holding the key flag values.
*/
public class KeyFlags
: SignatureSubpacket
{
public const int CertifyOther = 0x01;
public const int SignData = 0x02;
public const int EncryptComms = 0x04;
public const int EncryptStorage = 0x08;
public const int Split = 0x10;
public const int Authentication = 0x20;
public const int Shared = 0x80;
private static byte[] IntToByteArray(
int v)
{
byte[] tmp = new byte[4];
int size = 0;
for (int i = 0; i != 4; i++)
{
tmp[i] = (byte)(v >> (i * 8));
if (tmp[i] != 0)
{
size = i;
}
}
byte[] data = new byte[size + 1];
Array.Copy(tmp, 0, data, 0, data.Length);
return data;
}
public KeyFlags(
bool critical,
bool isLongLength,
byte[] data)
: base(SignatureSubpacketTag.KeyFlags, critical, isLongLength, data)
{
}
public KeyFlags(
bool critical,
int flags)
: base(SignatureSubpacketTag.KeyFlags, critical, false, IntToByteArray(flags))
{
}
/// <summary>
/// Return the flag values contained in the first 4 octets (note: at the moment
/// the standard only uses the first one).
/// </summary>
public int Flags
{
get
{
int flags = 0;
for (int i = 0; i != data.Length; i++)
{
flags |= (data[i] & 0xff) << (i * 8);
}
return flags;
}
}
}
}
#pragma warning restore
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6e84bad17972773488dbe07547a99912
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,117 @@
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
#pragma warning disable
using System;
using System.IO;
using System.Text;
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Bcpg.Sig
{
/**
* Class provided a NotationData object according to
* RFC2440, Chapter 5.2.3.15. Notation Data
*/
public class NotationData
: SignatureSubpacket
{
public const int HeaderFlagLength = 4;
public const int HeaderNameLength = 2;
public const int HeaderValueLength = 2;
public NotationData(
bool critical,
bool isLongLength,
byte[] data)
: base(SignatureSubpacketTag.NotationData, critical, isLongLength, data)
{
}
public NotationData(
bool critical,
bool humanReadable,
string notationName,
string notationValue)
: base(SignatureSubpacketTag.NotationData, critical, false,
CreateData(humanReadable, notationName, notationValue))
{
}
private static byte[] CreateData(
bool humanReadable,
string notationName,
string notationValue)
{
MemoryStream os = new MemoryStream();
// (4 octets of flags, 2 octets of name length (M),
// 2 octets of value length (N),
// M octets of name data,
// N octets of value data)
// flags
os.WriteByte(humanReadable ? (byte)0x80 : (byte)0x00);
os.WriteByte(0x0);
os.WriteByte(0x0);
os.WriteByte(0x0);
byte[] nameData, valueData = null;
int nameLength, valueLength;
nameData = Encoding.UTF8.GetBytes(notationName);
nameLength = System.Math.Min(nameData.Length, 0xFF);
valueData = Encoding.UTF8.GetBytes(notationValue);
valueLength = System.Math.Min(valueData.Length, 0xFF);
// name length
os.WriteByte((byte)(nameLength >> 8));
os.WriteByte((byte)(nameLength >> 0));
// value length
os.WriteByte((byte)(valueLength >> 8));
os.WriteByte((byte)(valueLength >> 0));
// name
os.Write(nameData, 0, nameLength);
// value
os.Write(valueData, 0, valueLength);
return os.ToArray();
}
public bool IsHumanReadable
{
get { return data[0] == 0x80; }
}
public string GetNotationName()
{
int nameLength = ((data[HeaderFlagLength] << 8) + (data[HeaderFlagLength + 1] << 0));
int namePos = HeaderFlagLength + HeaderNameLength + HeaderValueLength;
return Encoding.UTF8.GetString(data, namePos, nameLength);
}
public string GetNotationValue()
{
int nameLength = ((data[HeaderFlagLength] << 8) + (data[HeaderFlagLength + 1] << 0));
int valueLength = ((data[HeaderFlagLength + HeaderNameLength] << 8) + (data[HeaderFlagLength + HeaderNameLength + 1] << 0));
int valuePos = HeaderFlagLength + HeaderNameLength + HeaderValueLength + nameLength;
return Encoding.UTF8.GetString(data, valuePos, valueLength);
}
public byte[] GetNotationValueBytes()
{
int nameLength = ((data[HeaderFlagLength] << 8) + (data[HeaderFlagLength + 1] << 0));
int valueLength = ((data[HeaderFlagLength + HeaderNameLength] << 8) + (data[HeaderFlagLength + HeaderNameLength + 1] << 0));
int valuePos = HeaderFlagLength + HeaderNameLength + HeaderValueLength + nameLength;
byte[] bytes = new byte[valueLength];
Array.Copy(data, valuePos, bytes, 0, valueLength);
return bytes;
}
}
}
#pragma warning restore
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 81ad0e2ea94abef40a6e574dfbe58cb5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,57 @@
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
#pragma warning disable
using System;
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Bcpg.Sig
{
/**
* packet giving signature creation time.
*/
public class PreferredAlgorithms
: SignatureSubpacket
{
private static byte[] IntToByteArray(
int[] v)
{
byte[] data = new byte[v.Length];
for (int i = 0; i != v.Length; i++)
{
data[i] = (byte)v[i];
}
return data;
}
public PreferredAlgorithms(
SignatureSubpacketTag type,
bool critical,
bool isLongLength,
byte[] data)
: base(type, critical, isLongLength, data)
{
}
public PreferredAlgorithms(
SignatureSubpacketTag type,
bool critical,
int[] preferences)
: base(type, critical, false, IntToByteArray(preferences))
{
}
public int[] GetPreferences()
{
int[] v = new int[data.Length];
for (int i = 0; i != v.Length; i++)
{
v[i] = data[i] & 0xff;
}
return v;
}
}
}
#pragma warning restore
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7ff240d30792bb948baa99025e3a8e45
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,40 @@
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
#pragma warning disable
using System;
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Bcpg.Sig
{
/**
* packet giving whether or not the signature is signed using the primary user ID for the key.
*/
public class PrimaryUserId
: SignatureSubpacket
{
private static byte[] BooleanToByteArray(bool val)
{
return new byte[1]{ Convert.ToByte(val) };
}
public PrimaryUserId(
bool critical,
bool isLongLength,
byte[] data)
: base(SignatureSubpacketTag.PrimaryUserId, critical, isLongLength, data)
{
}
public PrimaryUserId(
bool critical,
bool isPrimaryUserId)
: base(SignatureSubpacketTag.PrimaryUserId, critical, false, BooleanToByteArray(isPrimaryUserId))
{
}
public bool IsPrimaryUserId()
{
return data[0] != 0;
}
}
}
#pragma warning restore
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 02f54dbba8c88794cac57757f58388d5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,40 @@
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
#pragma warning disable
using System;
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Bcpg.Sig
{
/**
* packet giving whether or not is revocable.
*/
public class Revocable
: SignatureSubpacket
{
private static byte[] BooleanToByteArray(bool value)
{
return new byte[1]{ Convert.ToByte(value) };
}
public Revocable(
bool critical,
bool isLongLength,
byte[] data)
: base(SignatureSubpacketTag.Revocable, critical, isLongLength, data)
{
}
public Revocable(
bool critical,
bool isRevocable)
: base(SignatureSubpacketTag.Revocable, critical, false, BooleanToByteArray(isRevocable))
{
}
public bool IsRevocable()
{
return data[0] != 0;
}
}
}
#pragma warning restore
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d1c5e4322da8e984d8ceddeadafde509
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,67 @@
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
#pragma warning disable
using System;
using System.Text;
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Bcpg
{
/// <summary>
/// Represents revocation key OpenPGP signature sub packet.
/// </summary>
public class RevocationKey
: SignatureSubpacket
{
// 1 octet of class,
// 1 octet of public-key algorithm ID,
// 20 octets of fingerprint
public RevocationKey(
bool isCritical,
bool isLongLength,
byte[] data)
: base(SignatureSubpacketTag.RevocationKey, isCritical, isLongLength, data)
{
}
public RevocationKey(
bool isCritical,
RevocationKeyTag signatureClass,
PublicKeyAlgorithmTag keyAlgorithm,
byte[] fingerprint)
: base(SignatureSubpacketTag.RevocationKey, isCritical, false,
CreateData(signatureClass, keyAlgorithm, fingerprint))
{
}
private static byte[] CreateData(
RevocationKeyTag signatureClass,
PublicKeyAlgorithmTag keyAlgorithm,
byte[] fingerprint)
{
byte[] data = new byte[2 + fingerprint.Length];
data[0] = (byte)signatureClass;
data[1] = (byte)keyAlgorithm;
Array.Copy(fingerprint, 0, data, 2, fingerprint.Length);
return data;
}
public virtual RevocationKeyTag SignatureClass
{
get { return (RevocationKeyTag)this.GetData()[0]; }
}
public virtual PublicKeyAlgorithmTag Algorithm
{
get { return (PublicKeyAlgorithmTag)this.GetData()[1]; }
}
public virtual byte[] GetFingerprint()
{
byte[] data = this.GetData();
byte[] fingerprint = new byte[data.Length - 2];
Array.Copy(data, 2, fingerprint, 0, fingerprint.Length);
return fingerprint;
}
}
}
#pragma warning restore
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f9eaf5618aa97844784334746109bbae
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,13 @@
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
#pragma warning disable
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Bcpg
{
public enum RevocationKeyTag
: byte
{
ClassDefault = 0x80,
ClassSensitive = 0x40
}
}
#pragma warning restore
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2e1338967dd169249b5b7bc5386e27f2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,61 @@
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
#pragma warning disable
using System;
using System.Text;
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Bcpg
{
/// <summary>
/// Represents revocation reason OpenPGP signature sub packet.
/// </summary>
public class RevocationReason
: SignatureSubpacket
{
public RevocationReason(bool isCritical, bool isLongLength, byte[] data)
: base(SignatureSubpacketTag.RevocationReason, isCritical, isLongLength, data)
{
}
public RevocationReason(
bool isCritical,
RevocationReasonTag reason,
string description)
: base(SignatureSubpacketTag.RevocationReason, isCritical, false, CreateData(reason, description))
{
}
private static byte[] CreateData(
RevocationReasonTag reason,
string description)
{
byte[] descriptionBytes = Strings.ToUtf8ByteArray(description);
byte[] data = new byte[1 + descriptionBytes.Length];
data[0] = (byte)reason;
Array.Copy(descriptionBytes, 0, data, 1, descriptionBytes.Length);
return data;
}
public virtual RevocationReasonTag GetRevocationReason()
{
return (RevocationReasonTag)GetData()[0];
}
public virtual string GetRevocationDescription()
{
byte[] data = GetData();
if (data.Length == 1)
return string.Empty;
byte[] description = new byte[data.Length - 1];
Array.Copy(data, 1, description, 0, description.Length);
return Strings.FromUtf8ByteArray(description);
}
}
}
#pragma warning restore
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c90f793064eac8c49b88ec465e9e4801
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,18 @@
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
#pragma warning disable
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Bcpg
{
public enum RevocationReasonTag
: byte
{
NoReason = 0, // No reason specified (key revocations or cert revocations)
KeySuperseded = 1, // Key is superseded (key revocations)
KeyCompromised = 2, // Key material has been compromised (key revocations)
KeyRetired = 3, // Key is retired and no longer used (key revocations)
UserNoLongerValid = 32, // User ID information is no longer valid (cert revocations)
// 100-110 - Private Use
}
}
#pragma warning restore
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2cef5753ad3f65047a1b282c84764d3a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,40 @@
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
#pragma warning disable
using System;
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Crypto.Utilities;
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities.Date;
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Bcpg.Sig
{
/**
* packet giving signature creation time.
*/
public class SignatureCreationTime
: SignatureSubpacket
{
protected static byte[] TimeToBytes(DateTime time)
{
long t = DateTimeUtilities.DateTimeToUnixMs(time) / 1000L;
return Pack.UInt32_To_BE((uint)t);
}
public SignatureCreationTime(bool critical, bool isLongLength, byte[] data)
: base(SignatureSubpacketTag.CreationTime, critical, isLongLength, data)
{
}
public SignatureCreationTime(bool critical, DateTime date)
: base(SignatureSubpacketTag.CreationTime, critical, false, TimeToBytes(date))
{
}
public DateTime GetTime()
{
uint time = Pack.BE_To_UInt32(data, 0);
return DateTimeUtilities.UnixMsToDateTime(time * 1000L);
}
}
}
#pragma warning restore
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: cc33b36b4be60784aa69a717fa1cec23
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,35 @@
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
#pragma warning disable
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Crypto.Utilities;
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Bcpg.Sig
{
/**
* packet giving signature expiration time.
*/
public class SignatureExpirationTime
: SignatureSubpacket
{
protected static byte[] TimeToBytes(long t)
{
return Pack.UInt32_To_BE((uint)t);
}
public SignatureExpirationTime(bool critical, bool isLongLength, byte[] data)
: base(SignatureSubpacketTag.ExpireTime, critical, isLongLength, data)
{
}
public SignatureExpirationTime(bool critical, long seconds)
: base(SignatureSubpacketTag.ExpireTime, critical, false, TimeToBytes(seconds))
{
}
/**
* return time in seconds before signature expires after creation time.
*/
public long Time => Pack.BE_To_UInt32(data, 0);
}
}
#pragma warning restore
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e5470a08723646a4ebe1b4dddb7af999
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,53 @@
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
#pragma warning disable
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Bcpg.Sig
{
/**
* packet giving the User ID of the signer.
*/
public class SignerUserId
: SignatureSubpacket
{
private static byte[] UserIdToBytes(
string id)
{
byte[] idData = new byte[id.Length];
for (int i = 0; i != id.Length; i++)
{
idData[i] = (byte)id[i];
}
return idData;
}
public SignerUserId(
bool critical,
bool isLongLength,
byte[] data)
: base(SignatureSubpacketTag.SignerUserId, critical, isLongLength, data)
{
}
public SignerUserId(
bool critical,
string userId)
: base(SignatureSubpacketTag.SignerUserId, critical, false, UserIdToBytes(userId))
{
}
public string GetId()
{
char[] chars = new char[data.Length];
for (int i = 0; i != chars.Length; i++)
{
chars[i] = (char)(data[i] & 0xff);
}
return new string(chars);
}
}
}
#pragma warning restore
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9f72fc08b5dfd3e4b99640a0365a108a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,48 @@
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
#pragma warning disable
using System;
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Bcpg.Sig
{
/**
* packet giving trust.
*/
public class TrustSignature
: SignatureSubpacket
{
private static byte[] IntToByteArray(
int v1,
int v2)
{
return new byte[]{ (byte)v1, (byte)v2 };
}
public TrustSignature(
bool critical,
bool isLongLength,
byte[] data)
: base(SignatureSubpacketTag.TrustSig, critical, isLongLength, data)
{
}
public TrustSignature(
bool critical,
int depth,
int trustAmount)
: base(SignatureSubpacketTag.TrustSig, critical, false, IntToByteArray(depth, trustAmount))
{
}
public int Depth
{
get { return data[0] & 0xff; }
}
public int TrustAmount
{
get { return data[1] & 0xff; }
}
}
}
#pragma warning restore
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 25abbc01b4edc0440a4b6ef04b9ba858
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: