SMIMEEncryptionKeyPreferenceAttribute.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1;
  4. using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms;
  5. using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
  6. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Smime
  7. {
  8. /**
  9. * The SmimeEncryptionKeyPreference object.
  10. * <pre>
  11. * SmimeEncryptionKeyPreference ::= CHOICE {
  12. * issuerAndSerialNumber [0] IssuerAndSerialNumber,
  13. * receipentKeyId [1] RecipientKeyIdentifier,
  14. * subjectAltKeyIdentifier [2] SubjectKeyIdentifier
  15. * }
  16. * </pre>
  17. */
  18. public class SmimeEncryptionKeyPreferenceAttribute
  19. : AttributeX509
  20. {
  21. public SmimeEncryptionKeyPreferenceAttribute(
  22. IssuerAndSerialNumber issAndSer)
  23. : base(SmimeAttributes.EncrypKeyPref,
  24. new DerSet(new DerTaggedObject(false, 0, issAndSer)))
  25. {
  26. }
  27. public SmimeEncryptionKeyPreferenceAttribute(
  28. RecipientKeyIdentifier rKeyID)
  29. : base(SmimeAttributes.EncrypKeyPref,
  30. new DerSet(new DerTaggedObject(false, 1, rKeyID)))
  31. {
  32. }
  33. /**
  34. * @param sKeyId the subjectKeyIdentifier value (normally the X.509 one)
  35. */
  36. public SmimeEncryptionKeyPreferenceAttribute(
  37. Asn1OctetString sKeyID)
  38. : base(SmimeAttributes.EncrypKeyPref,
  39. new DerSet(new DerTaggedObject(false, 2, sKeyID)))
  40. {
  41. }
  42. }
  43. }
  44. #pragma warning restore
  45. #endif