Title: Exception occured while building CMS enveloped data. · Issue #584 · bcgit/bc-java · GitHub
Open Graph Title: Exception occured while building CMS enveloped data. · Issue #584 · bcgit/bc-java
X Title: Exception occured while building CMS enveloped data. · Issue #584 · bcgit/bc-java
Description: Hi, Could you help me with my issue? I try to build CMS enveloped data with my certificate, but exception happens. OS MacOS Mojave v10.14.6 java version 1.8 BC version either 1.60 or 1.62 My code private String createCmsData(X509Certific...
Open Graph Description: Hi, Could you help me with my issue? I try to build CMS enveloped data with my certificate, but exception happens. OS MacOS Mojave v10.14.6 java version 1.8 BC version either 1.60 or 1.62 My code p...
X Description: Hi, Could you help me with my issue? I try to build CMS enveloped data with my certificate, but exception happens. OS MacOS Mojave v10.14.6 java version 1.8 BC version either 1.60 or 1.62 My code p...
Opengraph URL: https://github.com/bcgit/bc-java/issues/584
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Exception occured while building CMS enveloped data.","articleBody":"Hi,\r\n\r\nCould you help me with my issue? I try to build CMS enveloped data with my certificate, but exception happens.\r\n- OS\r\nMacOS Mojave v10.14.6\r\n- java version\r\n1.8\r\n- BC version\r\neither 1.60 or 1.62\r\n- My code\r\n```java\r\nprivate String createCmsData(X509Certificate certificate, byte[] data) throws Exception {\r\n Security.addProvider(new BouncyCastleProvider());\r\n CMSEnvelopedDataGenerator envelopedGen = new CMSEnvelopedDataGenerator();\r\n envelopedGen.addRecipientInfoGenerator(new JceKeyTransRecipientInfoGenerator(certificate).setProvider(\"BC\"));\r\n CMSEnvelopedData ed = envelopedGen.generate(\r\n new CMSProcessableByteArray(data),\r\n new JceCMSContentEncryptorBuilder(NISTObjectIdentifiers.id_aes256_CBC).setProvider(\"BC\").build());\r\n\r\n // encode and return\r\n ...\r\n}\r\n```\r\n- My certificate\r\n```shell\r\nCertificate:\r\n Data:\r\n Version: 3 (0x2)\r\n Serial Number:\r\n 37:1f:99:d0:37:cd:c1:9a:b2:96:82:d1:fd:85:46:03:14:50:76:3c\r\n Signature Algorithm: sm2sign-with-sm3\r\n Issuer: CN = my.ca.local\r\n Validity\r\n Not Before: Sep 2 02:14:11 2019 GMT\r\n Not After : Sep 3 06:39:44 2019 GMT\r\n Subject: CN = ds1, OU = Sign, O = PKU, L = BJ, ST = BJ, C = CN\r\n Subject Public Key Info:\r\n Public Key Algorithm: id-ecPublicKey\r\n Public-Key: (256 bit)\r\n pub:\r\n 04:37:2e:49:4a:92:c1:01:87:e5:09:01:93:05:35:\r\n 88:ed:2a:af:81:17:41:18:2c:0c:0c:33:11:54:9d:\r\n 8b:3c:d4:de:16:03:f8:df:fa:08:84:8a:54:1f:49:\r\n 50:a5:09:d5:e5:0c:d1:83:93:f8:44:fd:e8:70:61:\r\n 91:28:e5:65:0b\r\n ASN1 OID: sm2p256v1\r\n NIST CURVE: SM2\r\n X509v3 extensions:\r\n X509v3 Basic Constraints: critical\r\n CA:FALSE\r\n X509v3 Authority Key Identifier: \r\n keyid:AB:46:5A:A6:73:C2:CC:C8:7E:00:76:B7:55:3F:1B:76:1E:7F:E5:FF\r\n\r\n X509v3 Subject Key Identifier: \r\n 7E:7E:E5:C1:E2:40:F0:B6:FC:FD:2A:56:25:33:D7:B4:35:C6:3E:73\r\n X509v3 Key Usage: critical\r\n Digital Signature, Non Repudiation, Key Encipherment, Data Encipherment\r\n Signature Algorithm: sm2sign-with-sm3\r\n 30:45:02:21:00:f7:86:6b:eb:b1:00:4a:d5:98:99:67:c4:f8:\r\n 8b:07:4d:11:ba:af:21:04:7b:53:90:f0:7b:f0:e4:5c:80:d7:\r\n 4b:02:20:6e:8d:7a:4d:6b:6c:45:c5:7e:02:d2:b2:01:3b:5e:\r\n 2c:50:a3:66:7d:51:d9:84:bc:7a:93:c0:68:28:a7:ce:30\r\n```\r\n- Exception trace\r\n```\r\nexception wrapping content key: cannot create cipher: No such algorithm: 1.2.840.10045.2.1\r\norg.bouncycastle.cms.CMSException: exception wrapping content key: cannot create cipher: No such algorithm: 1.2.840.10045.2.1\r\n\tat org.bouncycastle.cms.KeyTransRecipientInfoGenerator.generate(Unknown Source)\r\n\tat org.bouncycastle.cms.CMSEnvelopedDataGenerator.doGenerate(Unknown Source)\r\n\tat org.bouncycastle.cms.CMSEnvelopedDataGenerator.generate(Unknown Source)\r\n\t...\r\nCaused by: org.bouncycastle.operator.OperatorCreationException: cannot create cipher: No such algorithm: 1.2.840.10045.2.1\r\n\tat org.bouncycastle.operator.jcajce.OperatorHelper.createAsymmetricWrapper(Unknown Source)\r\n\tat org.bouncycastle.operator.jcajce.JceAsymmetricKeyWrapper.generateWrappedKey(Unknown Source)\r\n\t... 10 more\r\nCaused by: java.security.NoSuchAlgorithmException: No such algorithm: 1.2.840.10045.2.1\r\n\tat javax.crypto.Cipher.getInstance(Cipher.java:687)\r\n\tat javax.crypto.Cipher.getInstance(Cipher.java:595)\r\n\tat org.bouncycastle.jcajce.util.NamedJcaJceHelper.createCipher(Unknown Source)\r\n\t... 12 more\r\n```","author":{"url":"https://github.com/919704371","@type":"Person","name":"919704371"},"datePublished":"2019-09-02T03:01:39Z","url":"https://github.com/bcgit/bc-java/issues/584"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:a8ddd632-0f64-1bfd-38b2-80c3f21a5b4b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CDB8:2AB944:4677CC:5E7AA2:6AFBECD5 |
| html-safe-nonce | 66db9a41a8cfcae5d23b9424873c8d55ce0969978c6aa9bb4f7b18bacf59de5a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDREI4OjJBQjk0NDo0Njc3Q0M6NUU3QUEyOjZBRkJFQ0Q1IiwidmlzaXRvcl9pZCI6IjEwNTU4NzM1NDIwNzI4MjI5OTciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | ab040b1ffabe100207e5768d1052e0ef3a7643a661801dfe416495257256ce14 |
| hovercard-subject-tag | issue:487971759 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/bcgit/bc-java/584/issue_layout |
| twitter:image | https://opengraph.githubassets.com/817584c8b098c283aecdd6a255d3340d6f0e39803ed608322c8e3d2db9161cde/bcgit/bc-java/issues/584 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/817584c8b098c283aecdd6a255d3340d6f0e39803ed608322c8e3d2db9161cde/bcgit/bc-java/issues/584 |
| og:image:alt | Hi, Could you help me with my issue? I try to build CMS enveloped data with my certificate, but exception happens. OS MacOS Mojave v10.14.6 java version 1.8 BC version either 1.60 or 1.62 My code p... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | 919704371 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 744d4381b1c4dbd6d8736c7d7e5bbe7dc11217584e457a3555020c631764e8ec |
| turbo-cache-control | no-preview |
| go-import | github.com/bcgit/bc-java git https://github.com/bcgit/bc-java.git |
| octolytics-dimension-user_id | 4566970 |
| octolytics-dimension-user_login | bcgit |
| octolytics-dimension-repository_id | 10416648 |
| octolytics-dimension-repository_nwo | bcgit/bc-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 10416648 |
| octolytics-dimension-repository_network_root_nwo | bcgit/bc-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | df859c48a4c8b4c0009c19bb4e82101aacb4b998 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width