{"id":13704995,"url":"https://github.com/eclipse-californium/californium","last_synced_at":"2025-05-14T08:07:20.475Z","repository":{"id":38816050,"uuid":"43075480","full_name":"eclipse-californium/californium","owner":"eclipse-californium","description":"CoAP/DTLS Java Implementation ","archived":false,"fork":false,"pushed_at":"2025-05-06T16:40:56.000Z","size":28102,"stargazers_count":746,"open_issues_count":17,"forks_count":372,"subscribers_count":50,"default_branch":"main","last_synced_at":"2025-05-06T17:45:56.891Z","etag":null,"topics":["coap","dtls","eclipseiot","internet-of-things","iot","java"],"latest_commit_sha":null,"homepage":"https://www.eclipse.org/californium/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eclipse-californium.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2015-09-24T15:27:15.000Z","updated_at":"2025-05-06T16:41:00.000Z","dependencies_parsed_at":"2024-01-16T09:44:02.659Z","dependency_job_id":"687bc772-67d7-41b7-a328-5bc1c5c1e051","html_url":"https://github.com/eclipse-californium/californium","commit_stats":{"total_commits":3263,"total_committers":74,"mean_commits":44.0945945945946,"dds":0.6840330983757279,"last_synced_commit":"a525d5585a005a74d6c0049c6fa166bdcbf91061"},"previous_names":["eclipse/californium"],"tags_count":88,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eclipse-californium%2Fcalifornium","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eclipse-californium%2Fcalifornium/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eclipse-californium%2Fcalifornium/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eclipse-californium%2Fcalifornium/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eclipse-californium","download_url":"https://codeload.github.com/eclipse-californium/californium/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254101617,"owners_count":22014909,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["coap","dtls","eclipseiot","internet-of-things","iot","java"],"created_at":"2024-08-02T22:00:29.470Z","updated_at":"2025-05-14T08:07:15.464Z","avatar_url":"https://github.com/eclipse-californium.png","language":"Java","funding_links":[],"categories":["Libraries","物联网"],"sub_categories":["Java","文件同步"],"readme":"![Californium logo](cf_64.png)\n\n# Californium (Cf) - CoAP for Java\n\nEclipse Californium is a Java implementation of [RFC7252 - Constrained Application Protocol](http://tools.ietf.org/html/rfc7252) for IoT Cloud services. Thus, the focus is on scalability and usability instead of resource-efficiency like for embedded devices. Yet Californium is also suitable for embedded JVMs.\n\nMore information can be found at\n[http://eclipse.dev/californium/](http://eclipse.dev/californium/)\nand [http://coap.technology/](http://coap.technology/).\n\nLike to help improving Californium? Then consider to [contribute](#contributing).\n\n# Build using Maven\n\nYou need to have a working maven installation to build Californium.\nThen simply run the following from the project's root directory:\n\n```sh\n$ mvn clean install\n```\n\nExecutable JARs of the examples with all dependencies can be found in the `demo-apps/run` folder.\n\nThe build-process in branch `main` is tested for jdk8, jdk 11, jdk 17 and jdk 21. \n\nTo generate the javadocs, add \"-DcreateJavadoc=true\" to the command line and set the `JAVA_HOME`.\n\n```sh\n$ mvn clean install -DcreateJavadoc=true\n```\n\n```sh\n$ mvn clean install -DuseToolchainJavadoc=true\n```\n\n## Build with EdDSA support\n\nTo support EdDSA requires java 17 (or newer). Earlier versions of Californium\nalso supported to use [ed25519-java](https://github.com/str4d/ed25519-java) at runtime, but that library seems to be not\nmaintained for long and therefore the support in Californium has been removed.\n\n## Run unit tests using Bouncy Castle as alternative JCE provider\n\nWith 3.0 a first, experimental support for using Bouncy Castle (starting with version 1.69, bcprov-jdk15on, bcpkix-jdk15on, and, for tls, bctls-jdk15on) is implemented. Version 4.0 bc version 1.78.1 gets supported.\n\nTo demonstrate the basic functions, run the unit-tests using the profile `bc-tests`\n\n```sh\n$ mvn clean install -Pbc-tests\n```\n\nSupporting Bouncy Castle for the unit test uncovers a couple of differences, which required to adapt the implementation. It is assumed, that more will be found and more adaption will be required. If you find some, don't hesitate to report issues, perhaps research and analysis, and fixes. On the other hand, the project Californium will for now not be able to provide support for Bouncy Castle questions with or without relation to Californium. You may create issues, but it may be not possible for us to answer them.\n\nOn issue seems to be the `SecureRandom` generator of BC. Dependent on the runtime environment, that is based on `SecureRandom.getInstanceStrong()`, which has blocking behaviour by default. If the platform your application runs on, has not enough entropy to start the `SecureRandom`, BC waits until that gets available. In common cases, that starts quite fast, but in some cases, that takes up to 60s (and more).\n\nOne option to overcome that on some linux variants is using `rng-tools`. That may help to provide more entropy.\n\nA second option o overcome that is to setup `CALIFORNIUM_JCE_PROVIDER` using the value `BC_NON_BLOCKING_RANDOM` instead of `BC`. The `JceProviderUtil` then adapts `SecureRandom` to use a, maybe weaker, non-blocking `SecureRandom`. If that works, depends unfortunately on your platform, so especially for Android, that may not work. In that cases, please use `BC` as `CALIFORNIUM_JCE_PROVIDER` and configure \"securerandom.strongAlgorithms\" ahead with\n\n```\nSecurity.setProperty(\"securerandom.strongAlgorithms\", \"\u003cyour-android-algorithm\u003e\");\n```\n\naccording your android variant. That may require some analysis by you.\n\nWith that, it gets very time consuming to test all combinations. Therefore, if you need a specific one, please test it on your own. If you consider, that some adaption is required, let us know by creating an issue or PR.\n\n# Using Californium in Maven Projects\n\nWe are publishing Californium's artifacts for milestones and releases to [Maven Central](https://search.maven.org/search?q=g:org.eclipse.californium%20a:parent%20v:4.0.0-M3).\nTo use the latest released version as a library in your projects, add the following dependency\nto your `pom.xml` (without the dots `...`):\n\n```xml\n  \u003cdependencies\u003e\n    ...\n    \u003cdependency\u003e\n            \u003cgroupId\u003eorg.eclipse.californium\u003c/groupId\u003e\n            \u003cartifactId\u003ecalifornium-core\u003c/artifactId\u003e\n            \u003cversion\u003e3.13.0\u003c/version\u003e\n    \u003c/dependency\u003e\n    ...\n  \u003c/dependencies\u003e\n  ...\n```\n\nor\n\n```xml\n  \u003cdependencies\u003e\n    ...\n    \u003cdependency\u003e\n            \u003cgroupId\u003eorg.eclipse.californium\u003c/groupId\u003e\n            \u003cartifactId\u003ecalifornium-core\u003c/artifactId\u003e\n            \u003cversion\u003e4.0.0-M3\u003c/version\u003e\n    \u003c/dependency\u003e\n    ...\n  \u003c/dependencies\u003e\n  ...\n```\n\n**Note:** the API of milestone release `4.0.0-M3` isn't stable yet.\n\n##### Current Builds\n\nYou can also be bold and try out the most recent build from `main`.\nHowever, we are not publishing those to Maven Central but to Californium's project repository at Eclipse only.\nYou will therefore need to add the Eclipse Repository to your `pom.xml` first:\n\n```\n  \u003crepositories\u003e\n    ...\n    \u003crepository\u003e\n      \u003cid\u003erepo.eclipse.org\u003c/id\u003e\n      \u003cname\u003eCalifornium Repository\u003c/name\u003e\n      \u003curl\u003ehttps://repo.eclipse.org/content/repositories/californium/\u003c/url\u003e\n    \u003c/repository\u003e\n    ...\n  \u003c/repositories\u003e\n```\nYou can then simply depend on `4.0.0-SNAPSHOT`.\n\n# Eclipse\n\nThe project can be easily imported into a recent version of the Eclipse IDE.\nMake sure to have the following before importing the Californium (Cf) projects:\n\n* [Eclipse EGit](http://www.eclipse.org/egit/) (should be the case with every recent Eclipse version)\n* [m2e - Maven Integration for Eclipse](http://www.eclipse.org/m2e/) (should be the case with every recent Eclipse version)\n* UTF-8 workspace text file encoding (Preferences \u0026raquo; General \u0026raquo; Workspace)\n\nThen choose *[Import... \u0026raquo; Maven \u0026raquo; Existing Maven Projects]* to import `californium - parent` together with all sub-modules into Eclipse.\n\n# IntelliJ\n\nThe project can also be imported to IntelliJ as follows:\n\nIn IntelliJ, choose *[File.. \u0026raquo; Open]* then select the location of the cloned repository in your filesystem. IntelliJ will then automatically import all projects and resolve required Maven dependencies.\n\n# Interop Server\n\nA test server is running at \u003ca href=\"coap://californium.eclipseprojects.io:5683/\"\u003ecoap://californium.eclipseprojects.io:5683/\u003c/a\u003e\n\nIt is an instance of the [cf-plugtest-server](https://repo.eclipse.org/content/repositories/californium-releases/org/eclipse/californium/cf-plugtest-server/4.0.0-M3/cf-plugtest-server-4.0.0-M3.jar) from the demo-apps.\nThe root resource responds with its current version.\n\nFor a preview to the [Return Routability Check for DTLS 1.2 and DTLS 1.3](https://tlswg.org/dtls-rrc/draft-ietf-tls-dtls-rrc.html) experimental support, please read [feature/rrc - branch](https://github.com/eclipse-californium/californium/tree/feature/rrc).\n\n**Please note:**\nThe server is intended to test the interoperability of CoAP and DTLS 1.2. Data sent to that server is typically \"Hello world\". The data is public visible to all other users and is removed on any restart. Please don't send data, which requires \"data privacy\", the sandbox server is not intended for such usage. \n\nMore information can be found at [http://www.eclipse.org/californium](http://www.eclipse.org/californium) and technical details at [https://projects.eclipse.org/projects/iot.californium](https://projects.eclipse.org/projects/iot.californium).\n\nAnother interop server with a different implementation can be found at\n[coap://coap.me:5683/](coap://coap.me:5683/).\nMore information can be found at [http://coap.me/](http://coap.me/).\n\n## Interop Server - (D)TLS Support\n\nThe server uses the [x509 Demo Certificates](/demo_certs), which are usually recreated and replaced once a year.\nAnd the PSK credentials:\n\n| Identity | Secret | Remark |\n| -------- | ------ | ------ |\n| \"Client_identity\" | \"secretPSK\" | openssl defaults |\n| \"password\" | \"sesame\" | ETSI Plugtest test spec |\n| Regex \"`cali\\..*`\" | \".fornium\" | Wildcard Identity for plugtest |\n| Regex \"`^[^@]{8,}@.{8,}$`\" | \"secret\" | Wildcard Identity for hono-identites |\n\n**Note:** TLS supports only the x509 Demo Certificates. To enable a client to use x509, please add the below CA certificate to it's trusts.\n\n```\nBag Attributes\n    friendlyName: C=CA,L=Ottawa,O=Eclipse IoT,OU=Californium,CN=cf-ca\nsubject=CN = cf-ca, OU = Californium, O = Eclipse IoT, L = Ottawa, C = CA\n\nissuer=CN = cf-root, OU = Californium, O = Eclipse IoT, L = Ottawa, C = CA\n\n-----BEGIN CERTIFICATE-----\nMIICDDCCAbKgAwIBAgIIPKO8L7vZoqAwCgYIKoZIzj0EAwIwXDEQMA4GA1UEAxMH\nY2Ytcm9vdDEUMBIGA1UECxMLQ2FsaWZvcm5pdW0xFDASBgNVBAoTC0VjbGlwc2Ug\nSW9UMQ8wDQYDVQQHEwZPdHRhd2ExCzAJBgNVBAYTAkNBMB4XDTIzMTAyNjA4MDgx\nNVoXDTI1MTAyNTA4MDgxNVowWjEOMAwGA1UEAxMFY2YtY2ExFDASBgNVBAsTC0Nh\nbGlmb3JuaXVtMRQwEgYDVQQKEwtFY2xpcHNlIElvVDEPMA0GA1UEBxMGT3R0YXdh\nMQswCQYDVQQGEwJDQTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABLCbJjxIS4hI\nAnRFTlx23gkd4zyFd50zdpTnoUPz19oQ1o1youavC5Go9vrYoWxyx+zpph8T4brB\nC/mZGIgPVMOjYDBeMB0GA1UdDgQWBBSxVzoI1TL87++hsUb9vQwqODzgUTALBgNV\nHQ8EBAMCAQYwDwYDVR0TBAgwBgEB/wIBATAfBgNVHSMEGDAWgBTqNhC1fqOTsHRn\nIVZ9OabfWsxpcTAKBggqhkjOPQQDAgNIADBFAiBSEn3egc31JhhHTVYi5uhl0t4d\newujkEmwzBuruzf/xAIhAK/fXy2tsNoyLitFQ97x6LYV25jKmLKUlhL2mC/PwQdO\n-----END CERTIFICATE-----\n```\n\n## Interop Server - OSCORE Support\n\nThe server has a resource only accessible using OSCORE under \"/oscore\". It is configured with the following security material (client side):\n\n```\nMaster Secret: 0x0102030405060708090a0b0c0d0e0f10 (16 bytes)\nMaster Salt:   0x9e7ca92223786340 (8 bytes)\nSender ID:     0x01 (1 byte)\nRecipient ID:  0x02 (1 byte)\nID Context:    0x37cbf3210017a2d3 (8 bytes)\n(See up to date parameters in \"/oscoreInfo\" resource)\n```\n\nNote that the server supports running the Appendix B.2 context rederivation procedure. This is necessary as requests from new clients would otherwise be considered replays (as the server's replay window is filled up from earlier clients). To access this resource without using the Appendix B.2 procedure, an appropriate Sender Sequence Number to use and the current ID Context can be retrieved from the resource \"/oscoreInfo\" using plain CoAP.\n\nCurrently Californium's OSCORE supports the following algorithms:\n\nOSCORE Encryption:\n- AES_CCM_16_64_128, id 10\n- AES_CCM_64_64_128, id 12\n- AES_CCM_16_128_128, id 30\n- AES_CCM_64_128_128, id 32\n- AES_CCM_16_64_256, id 11\n- AES_CCM_64_64_256, id 13\n- AES_CCM_16_128_256, id 31\n- AES_CCM_64_128_256, id 33\n- AES_GCM_128, id 1\n- AES_GCM_192, id 2\n- AES_GCM_256, id 3\n- CHACHA20_POLY1305, id 24\n\nOSCORE Key Derivation:\n- HKDF_HMAC_SHA_256, id -10 \n- HKDF_HMAC_SHA_512, id -11\n\nFor detailed information about the algorithms see the [COSE Algorithms IANA registry](https://www.iana.org/assignments/cose/cose.xhtml#algorithms).\n\n## Interop Server - MyContext\n\nThe interop-server supports also a \"mycontext\" resource. The response contains the information about the client on the server side.\n\nExamples:\n\n```\n\u003e coap-client -p 15683 -m GET coap://californium.eclipseprojects.io/mycontext\n\nip: 2a02:????:915b\nport: 15683\nserver: Cf 4.0.0-M3\n```\n\n```\n\u003e coap-client -p 15684 -m GET -u Client_identity -k secretPSK coaps://californium.eclipseprojects.io/mycontext\n\nip: 2a02:????:915b\nport: 15684\npeer: Client_identity\ncipher-suite: TLS_PSK_WITH_AES_128_CCM_8\nsession-id: 3BBC6EBAAA4F4A4717EEC8FF2C3FB1CFC4C9C89E9807EB0F1C0CDC11C6D9110C\nread-cid: 1CF2CC41B37E\nwrite-cid: \nsecure-renegotiation: true\next-master-secret: true\nnewest-record: true\nmessage-size-limit: 1343\nserver: Cf 4.0.0-M3\n```\n\n`ip` and `port` may be used to detect some NATs on the ip-route. If the `port:` in the response differs from the provided port in the cli (`-p`), then that's a first indication of some NAT. If a client send a new request a couple of minutes later and `ip` or `port` are changing, then that may also indicate a NAT. If the client uses DTLS without the Connection ID extension (no `read-cid`), then the request may timeout. In that case, try to use CoAP without encryption to see,  if the `ip` or `port` changes.\n\n# Adapter Selection\n\nFor some systems (particularly when multicasting), it may be necessary to specify/restrict californium to a particular network interface, or interfaces. This can be\n achieved by setting the `COAP_NETWORK_INTERFACES` JVM parameter to a suitable regex, for example:\n \n`java -DCOAP_NETWORK_INTERFACES='.*wpan0' -jar target/cf-helloworld-server-4.0.0-M3.jar MulticastTestServer`\n\n# Contact\n\nA bug, an idea, an issue? Join the [Mailing list](https://dev.eclipse.org/mailman/listinfo/cf-dev)\nor create an issue here on GitHub.\n\n# Contributing\n\nPlease check out our [contribution guidelines](CONTRIBUTING.md)\n\nThere are a couple of [enhancement issues](https://github.com/eclipse-californium/californium/issues?q=is%3Aissue+label%3Ahibernate), which have been closed for longer inactivity. Maybe, if you like to help and spend some time, you will be welcome.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feclipse-californium%2Fcalifornium","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feclipse-californium%2Fcalifornium","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feclipse-californium%2Fcalifornium/lists"}