InstallCertificateRequest.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using EVCB_OCPP.Packet.Features;
  2. using EVCB_OCPP.Packet.Messages.SubTypes;
  3. using Newtonsoft.Json;
  4. using Newtonsoft.Json.Converters;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.ComponentModel.DataAnnotations;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. namespace EVCB_OCPP.Packet.Messages.Security
  12. {
  13. public class InstallCertificateRequest:IRequest
  14. {
  15. public InstallCertificateRequest()
  16. {
  17. Action = Actions.InstallCertificate.ToString();
  18. }
  19. /// <summary>
  20. /// Indicates the certificate type that is sent.
  21. /// </summary>
  22. [Required]
  23. [JsonConverter(typeof(StringEnumConverter))]
  24. public CertificateUseEnumType certificateType { set; get; }
  25. /// <summary>
  26. /// An PEM encoded X.509 certificate.
  27. /// </summary>
  28. [Required]
  29. [StringLength(5500,MinimumLength =0)]
  30. public string certificate { set; get; }
  31. [JsonIgnore]
  32. public string Action { set; get; }
  33. public bool TransactionRelated()
  34. {
  35. return false;
  36. }
  37. public bool Validate()
  38. {
  39. return Validator.TryValidateObject(this, new ValidationContext(this), null, true);
  40. }
  41. }
  42. }