how can i sign a file in Qt using sha1 digest?
I need to sign a file using QCA and qca-ossl in Qt. the input is a private key 开发者_运维知识库and a zip file. in ruby this can be done like this
@sig = @key.sign(OpenSSL::Digest::SHA1.new, plain)
in Linux I can do this by with command:
openssl rsautl -sign -in file -inkey key.pem -out sig
Here the private key I got in qt by
QCA::PrivateKey seckey = QCA::KeyGenerator().createRSA(1024);
now I need to do the signing in qt
can anybody help me on this?
See QCA::PrivateKey::signMessage, QCA::SignatureAlgorithm and QCA::MemoryRegion
I guess something like:
QByteArray signResult = seckey.signMessage(QCA::MemoryRegion(plain),
QCA::EMSA1_SHA1);
精彩评论