[gmime] Import the CA certificate in the pkcs7 tests (needed for encryption)



commit 119a81615fe5cbe5b1fe26b58fbbaff84e3a1e8b
Author: Jeffrey Stedfast <fejj gnome org>
Date:   Sat Feb 25 08:34:51 2017 -0500

    Import the CA certificate in the pkcs7 tests (needed for encryption)

 tests/data/pkcs7/certificate-authority.crt |   38 +++++++++++++++++++
 tests/data/pkcs7/certificate-authority.key |   54 ++++++++++++++++++++++++++++
 tests/test-pkcs7.c                         |    7 +++-
 3 files changed, 98 insertions(+), 1 deletions(-)
---
diff --git a/tests/data/pkcs7/certificate-authority.crt b/tests/data/pkcs7/certificate-authority.crt
new file mode 100644
index 0000000..2a67da0
--- /dev/null
+++ b/tests/data/pkcs7/certificate-authority.crt
@@ -0,0 +1,38 @@
+-----BEGIN CERTIFICATE-----
+MIIGrTCCBJWgAwIBAgIJALvovXIr0jwtMA0GCSqGSIb3DQEBBQUAMIGVMQswCQYD
+VQQGEwJVUzEWMBQGA1UECBMNTWFzc2FjaHVzZXR0czEPMA0GA1UEBxMGQm9zdG9u
+MR8wHQYDVQQKExZFeGFtcGxlIEF1dGhvcml0eSBJbmMuMRQwEgYDVQQDEwtCcnVj
+ZSBXYXluZTEmMCQGCSqGSIb3DQEJARYXYnJ1Y2Uud2F5bmVAZXhhbXBsZS5jb20w
+HhcNMTcwMTI4MTQ1NzU0WhcNMTgwMTI4MTQ1NzU0WjCBlTELMAkGA1UEBhMCVVMx
+FjAUBgNVBAgTDU1hc3NhY2h1c2V0dHMxDzANBgNVBAcTBkJvc3RvbjEfMB0GA1UE
+ChMWRXhhbXBsZSBBdXRob3JpdHkgSW5jLjEUMBIGA1UEAxMLQnJ1Y2UgV2F5bmUx
+JjAkBgkqhkiG9w0BCQEWF2JydWNlLndheW5lQGV4YW1wbGUuY29tMIICIjANBgkq
+hkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA55DcNo5tcbS8VPM1mBj9L+x+9cNqFTlM
+4u/v4pE8K5SkYdEUqo/kfhtEoZ7fmj0c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z5oEM7
+q9bbvEZDU1xktN6FW2Os7wKP4PACW/pvyKeAw33+SbWeT/HCZ5LmvnlFZfdmVBBi
+pTAjHtoV7rlzr1XABdHRqKvLBmWw4qITGJzSDOZ+ArvoxU3QPjSNag1DKa47aoMu
+wtu8c7rYmPADwMOH1sSJTblTJa2gksw3SYz0f5uSRfonTn3Jtc4tMrtyB6PLsEbz
+T0w809fW/BhH2b+s10jlh8HpLE52TknCmeJJnDuOMQ7rFy2Q/aDMTWx4Iys6bbWi
+e45NCEogKFmiRJfmV0vAVO45U0nsEOHgtgDCHsLqqUJG/ivZb3desrs/041SWuDr
+5QQFuTpRkoM0q51V0RZGRqrRhJRr7DK3KuAW6zlrP4TEeMzj+vA3Vy7OE+rP8Gvn
+qFPnFz61O193776BwMJTn2ta4G4EQD4eyKqV29BCykmbFq+hLIDYJgy//oc9CQcM
+yUdgBMkW0Cx0nldlnSFpxmgP/G5HM+qT1+ZBxRAE7ELCRyfgNLneZd+KN0rnNybi
+75WX0IvcdHsbq2dXEqYtvd3bsxwBJtwAnA0R3Fy1OxnxloEDWulJnWuQVs6cIpAz
+zH0TlUX3wix3pNKoje2+ObkVliTzYGZnVk5dqbUgII2t
+-----END CERTIFICATE-----
diff --git a/tests/data/pkcs7/certificate-authority.key b/tests/data/pkcs7/certificate-authority.key
new file mode 100644
index 0000000..d82197f
--- /dev/null
+++ b/tests/data/pkcs7/certificate-authority.key
@@ -0,0 +1,54 @@
+-----BEGIN RSA PRIVATE KEY-----
+Proc-Type: 4,ENCRYPTED
+DEK-Info: DES-EDE3-CBC,6BC13F6FCDF6F5A3
+
+YFKBidYfRZ2smCkW8TY9X3USdF86cXiu/EFRzlRJW00wBin494zv/3+eePrmIETd
+e/jdUyrnTY546DFbP/gOzdH1n8eEMZwxSTcDrKTQf3IyNG1knq+UuarlivmHR16n
+t3r3WIoUVNdlRF4lsz7DUZ5VGHWQtbJOCTqpGL2yNfnQi/hXLOTKP0aBJYFn6Ts4
+f6M08jVtRkanHT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oei8pSPnFm20UYXlzZ
+F9kiyTiKrcDQSGfcPLjtf81m/RTruMVJylybFEfzOr7gzeO1wCaQlWt+TPdXRjrh
+2MM9ik+41STL74JqktFs0vJaR0FbMWe862BPXzTU51Izx7Q0XzxiU4kcvcRyEojP
+jDJ52SxPZheNrPIXxsEPrkwmmqNuuzLNz2CxpoqS3T9ym+vjeL5poY89riXa4oHf
+g8+c5MfOyKwJbC5rTqVa993vS51RmKogMLa23tf91EOziVy7qVcFuJrOdqMOoxZW
+mAKVocumIkf34NBM6OVYiiw2PQt87HZXG09BEZB51cy6cxqP+w2ewqT3n6MKOCds
+vwO8IEDIww3sHr4E/UEvzjqiFAF9inGR6OgKc/0vTttWa77/pDIHjcZHC8arYsRo
+jdk9iLw0vBioAMB3JwUSrdQsWAywCx8ksJlnzo0k94JQUKAuPVirnxA6wZifviB1
+TyCrtup6hSOMOVaXZgDwDe+Vzj6gY3OEk/VEuDiKPXVwiFm/aDDx4hb+DX640JNN
+xIOQOtLAkz7bS7cWY1JLaljEVH6Gq2aImZhbUiaTs0E6F+NhaDAxDMTgz/gwly6f
+4xkVvykE848q5E0OjlaifeFKQdeyL0S3Lwir29X2VZDhQWNzUPqupsWgt5coGJI0
+XQZ3ohaTV8fKmjnC+5PgXAgUd/KvvRoM6vEIQqUuuqnms89csYks8ozBnRvjQLe7
+kAoRHcmBp33i50iBr1KQzCKIxMR7SggH3Y8ZjlD3a/9WABNb7Awf+MdQ6J3tVJEd
+C7XMKrZd340h9R9wdCz5oB+SebVQLMmLu3/MfVzi68Hrz6x9pKVMwpbWYeed+WMT
+-----END RSA PRIVATE KEY-----
diff --git a/tests/test-pkcs7.c b/tests/test-pkcs7.c
index fcf8829..e1929e5 100644
--- a/tests/test-pkcs7.c
+++ b/tests/test-pkcs7.c
@@ -174,7 +174,7 @@ test_encrypt (GMimeCryptoContext *ctx, gboolean sign, GMimeStream *cleartext, GM
        
        g_mime_crypto_context_encrypt (ctx, sign, "mimekit example com",
                                       GMIME_DIGEST_ALGO_SHA256,
-                                      GMIME_ENCRYPT_FLAGS_ALWAYS_TRUST,
+                                      GMIME_ENCRYPT_FLAGS_NONE,
                                       recipients, cleartext, ciphertext,
                                       &err);
        
@@ -358,6 +358,11 @@ int main (int argc, char **argv)
        
        testsuite_check ("GMimePkcs7Context::import");
        try {
+               key = g_build_filename (datadir, "certificate-authority.crt", NULL);
+               //printf ("importing key: %s\n", key);
+               import_key (ctx, key);
+               g_free (key);
+               
                key = g_build_filename (datadir, "smime.p12", NULL);
                //printf ("importing key: %s\n", key);
                import_key (ctx, key);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]