FAQ
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

--

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 3 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedOct 5, '12 at 4:27p
activeOct 6, '12 at 6:37p
posts3
users2
websitegolang.org

2 users in discussion

Ryan Slade: 2 posts Agl: 1 post

People

Translate

site design / logo © 2022 Grokbase