pkcs#7

How to convert X509 certificate into PKCS7 using bouncycastle?

拟墨画扇 提交于 2019-12-13 02:48:09
问题 Hi, all! My problem is following: I 'm trying to encrypt X509 certificate to PKCS7 but I receive a wrong result. The first attempt is:(used bcmail-jdk16:1.46) Security.addProvider(new BouncyCastleProvider()); keystore = KeyStore.getInstance("PKCS12", "BC"); keystore.load (new FileInputStream(PATH+"//pkcs7-csr-cer//identity.p12"), "testpassword".toCharArray()); PrivateKey privateKey = (PrivateKey)keystore.getKey("testclientcert", "testpassword".toCharArray()); CMSSignedDataGenerator

Decrypting s/mime messages in p7m format with OpenSSL

不羁的心 提交于 2019-12-13 00:23:17
问题 I'm trying to decrypt p7m with OpenSSL but I cannot go through the error in the following part of the code: PKCS7 *p7 = NULL; in = BIO_new_file(convertedResourcePath, "r"); if (in) { NSLog(@"opening p7m file"); } else NSLog(@"cannot found p7m file"); out = BIO_new_file(convertedDecrFilePath, "w"); if (out) { NSLog(@"file for decription has been created"); } else NSLog(@"failed to create decription file"); p7 = SMIME_read_PKCS7(in, NULL); if (p7) { NSLog(@"start reading p7m file"); } else {

Why I am getting an error while opening digitally signed pdf document using PKCS7 and X509Certificate in C#?

无人久伴 提交于 2019-12-12 18:25:34
问题 I am trying to sign a pdf file using PKCS7 and X509Certificate but I get the following error when I open the signed pdf file in Adobe. Document has been altered or corrupted since it was signed Docuement Hash 66305799d97adc716694faa3aecb3b82136a76a57e0470fb289dcf727b83304b Following is my code: public class Helper { private static PdfPKCS7 _signature; private static PdfSignatureAppearance _apperance; private static byte[] _hash; private static byte[] _signatureHash; public static byte[]

API secured by PKCS#7 cryptographic message

纵然是瞬间 提交于 2019-12-12 13:19:12
问题 I am currently trying to call an API that requires me to put XML data in a PKCS#7 format. This data is posted to the API end point. The response also comes in a form of a PKCS#7 cryptographic messages (MIME-type is application/pkcs7-mime). Some Notes they provide: A cryptographic message doesn't contain any certification chains. Data compression is not used. Data encryption is not used. A cryptographic message is in the OpenSSL PEM format. I have been supplied two certificates. One I created

Invalid PKCS #7 block padding when using Crypto++

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 15:23:31
问题 We are using cryptopp library. We are using the below coding. Encryption is working file without any issue and we are able to get the cipher text. But getting an error while decrypting as "Block padding found". What could be the issue...? #include <iostream> #include <string> using namespace std; #include "cryptlib.h" #include "filters.h" #include "files.h" #include "modes.h" #include "hex.h" #include "aes.h" #include "osrng.h" using namespace CryptoPP; using CryptoPP::AutoSeededRandomPool;

Where to put information about padding length?

自作多情 提交于 2019-12-11 13:17:28
问题 I'm working on AES encryptor and decryptor. I've decided to use PKCS#7. And now, I've no idea where to put information about padding length. I've read that I can read last byte (==n) and check if it's lower than 16. If it's true i can check n bytes if they are equal n. But here is a thing. What if the last block to encrypt has 16 bytes and looks like this for exmaple: {0x01, 0xfa,..., 0xf1, 0x02, 0x02} After decryption, decryptor will read it and decide that two last bytes are padded (in fact

Decode PKCS#7 Signature via Windows API?

▼魔方 西西 提交于 2019-12-11 07:46:42
问题 I wish to parse and display the contents of an Authenticode PKCS#7 signature as extracted from a Window PE binary's Security Directory. I can use OpenSSL to do this on the command line with " openssl pkcs7 -text -in extracted_signature.pks -inform DER -print_certs ", however I need to do this via C/C++ and the Windows API. I cannot use the OpenSSL library itself. Using the CryptDecodeObjectEx API I can begin to decode the extracted signature: CRYPT_CONTENT_INFO * content_info; DWORD len;

Adding Certificates to CMS Signed Data

ぃ、小莉子 提交于 2019-12-11 05:24:21
问题 I am currently using the java Bouncy Castle libraries in order to create CMS signed data (or PKCS7 signed data). I seem however to be stuck with adding certificates (even though the certificate signer is properly added). I checked out this question about properly signing data, but it didn't respond the needs of my SCEP server. The code I used was from EJBCA but doesn't seem to add certificates to the PKCS7 signed data. When I parse the signed data with the openssl cms tool, I see that the

How can I extract signature from pkcs7 envelop?

主宰稳场 提交于 2019-12-11 03:16:03
问题 I want to extract signature from pkcs7 envelop. How can i do it ? 回答1: Use STACK_OF(PKCS7_SIGNER_INFO) *PKCS7_get_signer_info(PKCS7 *p7) to retrieve the individual SignerInfos contained in your PKCS7. To get the actual signature from an individual SignerInfo, you will have to access the corresponding pointer manually. PKCS7_SIGNER_INFO is defined as: typedef struct pkcs7_signer_info_st { ASN1_INTEGER *version; /* version 1 */ PKCS7_ISSUER_AND_SERIAL *issuer_and_serial; X509_ALGOR *digest_alg;

iOS/Swift x509 certificate, sign string

天大地大妈咪最大 提交于 2019-12-11 03:05:41
问题 I have x509 certificate (.crt) and private key (.key) I need to sign some string using a certificate in PKCS#7 detached signature(UTF8) Can you explain how to distribute certificate (key) and sign? UPDATE: it seems that i need analog of Cryptographic Message Syntax Services for iOs Is openSsl only one way to sign message using certificate? 来源: https://stackoverflow.com/questions/43227984/ios-swift-x509-certificate-sign-string