// Construct a SecCodeSigner
//
SecCodeSigner::SecCodeSigner(SecCSFlags flags)
- : mOpFlags(flags), mDigestAlgorithm(kSecCodeSignatureDefaultDigestAlgorithm), mLimitedAsync(NULL)
+ : mOpFlags(flags), mLimitedAsync(NULL)
{
}
return;
Signer operation(*this, code);
if ((flags | mOpFlags) & kSecCSRemoveSignature) {
- secdebug("signer", "%p will remove signature from %p", this, code);
+ secinfo("signer", "%p will remove signature from %p", this, code);
operation.remove(flags);
} else {
if (!valid())
MacOSError::throwMe(errSecCSInvalidObjectRef);
- secdebug("signer", "%p will sign %p (flags 0x%x)", this, code, flags);
+ secinfo("signer", "%p will sign %p (flags 0x%x)", this, code, flags);
operation.sign(flags);
}
code->resetValidity();
}
-//
-// Our DiskRep::signingContext methods communicate with the signing subsystem
-// in terms those callers can easily understand.
-//
-string SecCodeSigner::sdkPath(const std::string &path) const
-{
- assert(path[0] == '/'); // need absolute path here
- if (mSDKRoot)
- return cfString(mSDKRoot) + path;
- else
- return path;
-}
-
-bool SecCodeSigner::isAdhoc() const
-{
- return mSigner == SecIdentityRef(kCFNull);
-}
-
-SecCSFlags SecCodeSigner::signingFlags() const
-{
- return mOpFlags;
-}
-
-
//
// The actual parsing operation is done in the Parser class.
//
state.mCdFlagsGiven = false;
// digest algorithms are specified as a numeric code
- if (CFNumberRef digestAlgorithm = get<CFNumberRef>(kSecCodeSignerDigestAlgorithm))
- state.mDigestAlgorithm = cfNumber<unsigned int>(digestAlgorithm);
+ if (CFCopyRef<CFTypeRef> digestAlgorithms = get<CFTypeRef>(kSecCodeSignerDigestAlgorithm)) {
+ CFRef<CFArrayRef> array = cfArrayize(digestAlgorithms);
+ CFToVector<CodeDirectory::HashAlgorithm, CFNumberRef, cfNumber<CodeDirectory::HashAlgorithm> > digests(array);
+ std::copy(digests.begin(), digests.end(), std::inserter(state.mDigestAlgorithms, state.mDigestAlgorithms.begin()));
+ }
if (CFNumberRef cmsSize = get<CFNumberRef>(CFSTR("cmssize")))
state.mCMSSize = cfNumber<size_t>(cmsSize);