You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.8 KiB
57 lines
1.8 KiB
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR) |
|
#pragma warning disable |
|
using System; |
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto |
|
{ |
|
/// <summary> |
|
/// A simple block result object which just carries a byte array. |
|
/// </summary> |
|
public class SimpleBlockResult |
|
: IBlockResult |
|
{ |
|
private readonly byte[] result; |
|
|
|
/// <summary> |
|
/// Base constructor - a wrapper for the passed in byte array. |
|
/// </summary> |
|
/// <param name="result">The byte array to be wrapped.</param> |
|
public SimpleBlockResult(byte[] result) |
|
{ |
|
this.result = result; |
|
} |
|
|
|
/// <summary> |
|
/// Return the number of bytes in the result |
|
/// </summary> |
|
/// <value>The length of the result in bytes.</value> |
|
public int Length |
|
{ |
|
get { return result.Length; } |
|
} |
|
|
|
/// <summary> |
|
/// Return the final result of the operation. |
|
/// </summary> |
|
/// <returns>A block of bytes, representing the result of an operation.</returns> |
|
public byte[] Collect() |
|
{ |
|
return result; |
|
} |
|
|
|
/// <summary> |
|
/// Store the final result of the operation by copying it into the destination array. |
|
/// </summary> |
|
/// <returns>The number of bytes copied into destination.</returns> |
|
/// <param name="destination">The byte array to copy the result into.</param> |
|
/// <param name="offset">The offset into destination to start copying the result at.</param> |
|
public int Collect(byte[] destination, int offset) |
|
{ |
|
Array.Copy(result, 0, destination, offset, result.Length); |
|
|
|
return result.Length; |
|
} |
|
} |
|
} |
|
#pragma warning restore |
|
#endif
|
|
|