Library: OSP/BundleSign
Package: BundleSign
Header: Poco/OSP/BundleSign/BundleSigner.h
The BundleSigner class is used sign an existing bundle, using a digital signature algorithm based on the RSA and SHA1 message digest algorithms.
A signed bundle contains two additional files:
Member Functions: signBundle, signBundleDirectory, signBundleFile, writeDSAFile
BundleSigner(
const std::string & signer,
const Poco::Crypto::RSAKey & rsaKey
);
Creates a BundleSigner for signing bundles using the given RSA private/public key pair.
~BundleSigner();
Destroys the BundleSigner.
void signBundle(
const std::string & bundlePath
);
Signs the bundle given by path. The given path can either refer to a bundle file (in ZIP file format), or a bundle directory.
This method first computes the cryptographic hashes (SHA1) for all files in the bundle and creates the signature file (named "META-INF/<signer>.sf"). Then, a digital signature is created for the signature file, and stored in the bundle as well ("META-INF/<signer>.rsa").
void signBundle(
const std::string & bundlePath,
const Poco::Crypto::X509Certificate & certificate
);
Signs the bundle given by path. The given path can either refer to a bundle file (in ZIP file format), or a bundle directory.
This method first computes the cryptographic hashes (SHA1) for all files in the bundle and creates the signature file (named "META-INF/<signer>.sf"). Then, a digital signature is created for the signature file, and stored in the bundle as well ("META-INF/<signer>.rsa").
The given certificate is included in the digital signature file.
void signBundle(
const std::string & bundlePath,
const Poco::Crypto::X509Certificate * pCert
);
void signBundleDirectory(
const std::string & bundlePath,
const std::string & sfPath,
const std::string & rsaPath
);
void signBundleFile(
const std::string & bundlePath,
const std::string & sfPath,
const std::string & rsaPath
);
void writeDSAFile(
std::ostream & ostr,
const std::string & dsaSignature,
const Poco::Crypto::X509Certificate * pCert
);