crmfenc.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* -*- Mode: C; tab-width: 8 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #include "crmf.h"
  6. #include "crmfi.h"
  7. SECStatus
  8. CRMF_EncodeCertReqMsg(CRMFCertReqMsg *inCertReqMsg,
  9. CRMFEncoderOutputCallback fn,
  10. void *arg)
  11. {
  12. struct crmfEncoderOutput output;
  13. output.fn = fn;
  14. output.outputArg = arg;
  15. return SEC_ASN1Encode(inCertReqMsg, CRMFCertReqMsgTemplate,
  16. crmf_encoder_out, &output);
  17. }
  18. SECStatus
  19. CRMF_EncodeCertRequest(CRMFCertRequest *inCertReq,
  20. CRMFEncoderOutputCallback fn,
  21. void *arg)
  22. {
  23. struct crmfEncoderOutput output;
  24. output.fn = fn;
  25. output.outputArg = arg;
  26. return SEC_ASN1Encode(inCertReq, CRMFCertRequestTemplate,
  27. crmf_encoder_out, &output);
  28. }
  29. SECStatus
  30. CRMF_EncodeCertReqMessages(CRMFCertReqMsg **inCertReqMsgs,
  31. CRMFEncoderOutputCallback fn,
  32. void *arg)
  33. {
  34. struct crmfEncoderOutput output;
  35. CRMFCertReqMessages msgs;
  36. output.fn = fn;
  37. output.outputArg = arg;
  38. msgs.messages = inCertReqMsgs;
  39. return SEC_ASN1Encode(&msgs, CRMFCertReqMessagesTemplate,
  40. crmf_encoder_out, &output);
  41. }