X448PublicKeyParameters.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. using System.IO;
  5. using BestHTTP.SecureProtocol.Org.BouncyCastle.Math.EC.Rfc7748;
  6. using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
  7. using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.IO;
  8. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Parameters
  9. {
  10. public sealed class X448PublicKeyParameters
  11. : AsymmetricKeyParameter
  12. {
  13. public static readonly int KeySize = X448.PointSize;
  14. private readonly byte[] data = new byte[KeySize];
  15. public X448PublicKeyParameters(byte[] buf, int off)
  16. : base(false)
  17. {
  18. Array.Copy(buf, off, data, 0, KeySize);
  19. }
  20. public X448PublicKeyParameters(Stream input)
  21. : base(false)
  22. {
  23. if (KeySize != Streams.ReadFully(input, data))
  24. throw new EndOfStreamException("EOF encountered in middle of X448 public key");
  25. }
  26. public void Encode(byte[] buf, int off)
  27. {
  28. Array.Copy(data, 0, buf, off, KeySize);
  29. }
  30. public byte[] GetEncoded()
  31. {
  32. return Arrays.Clone(data);
  33. }
  34. }
  35. }
  36. #pragma warning restore
  37. #endif