Hi
I'm creating a package to build Apple passbook files and I need to sign a
file using private key and certificate.
I'm not sure where to begin however.
Ruby code to do the same thing is below, can this be done with the Go
standard library?
def sign_manifest
puts "Signing the manifest"
# Import the certificates
p12_certificate = OpenSSL::PKCS12::new(File.read(self.certificate_url),
self.certificate_password)
wwdr_certificate =
OpenSSL::X509::Certificate.new(File.read(self.wwdr_intermediate_certificate_path))
# Sign the data
flag = OpenSSL::PKCS7::BINARY|OpenSSL::PKCS7::DETACHED
signed = OpenSSL::PKCS7::sign(p12_certificate.certificate,
p12_certificate.key, File.read(self.manifest_url), [wwdr_certificate], flag)
# Create an output path for the signed data
self.signature_url = self.temporary_path + "/signature"
# Write out the data
File.open(self.signature_url, "w") do |f|
f.syswrite signed.to_der
end
end
Thanks
Ryan
--