+/*
+ * Set the hash agility attribute for a CMSEncoder.
+ * This is only used if the kCMSAttrAppleCodesigningHashAgility attribute
+ * is included.
+ */
+OSStatus CMSEncoderSetAppleCodesigningHashAgility(
+ CMSEncoderRef cmsEncoder,
+ CFDataRef hashAgilityAttrValue)
+{
+ if (cmsEncoder == NULL || cmsEncoder->encState != ES_Init) {
+ return errSecParam;
+ }
+ cmsEncoder->hashAgilityAttrValue = CFRetainSafe(hashAgilityAttrValue);
+ return errSecSuccess;
+}
+
+/*
+ * Set the hash agility attribute for a CMSEncoder.
+ * This is only used if the kCMSAttrAppleCodesigningHashAgilityV2 attribute
+ * is included.
+ */
+OSStatus CMSEncoderSetAppleCodesigningHashAgilityV2(
+ CMSEncoderRef cmsEncoder,
+ CFDictionaryRef hashAgilityV2AttrValues)
+{
+ if (cmsEncoder == NULL || cmsEncoder->encState != ES_Init) {
+ return errSecParam;
+ }
+ cmsEncoder->hashAgilityV2AttrValues = CFRetainSafe(hashAgilityV2AttrValues);
+ return errSecSuccess;
+}
+
+/*
+ * Set the expiration time for a CMSEncoder.
+ * This is only used if the kCMSAttrAppleExpirationTime attribute is included.
+ */
+OSStatus CMSEncoderSetAppleExpirationTime(
+ CMSEncoderRef cmsEncoder,
+ CFAbsoluteTime time)
+{
+ if(cmsEncoder == NULL) {
+ return errSecParam;
+ }
+ if(cmsEncoder->encState != ES_Init) {
+ return errSecParam;
+ }
+ cmsEncoder->expirationTime = time;
+ return errSecSuccess;
+}