-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9ecf564
Showing
18 changed files
with
1,509 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# EditorConfig is awesome: https://EditorConfig.org | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
# Unix-style newlines with a newline ending every file | ||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
|
||
# 4 space indentation | ||
[*.{cpp,h}] | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
# Tab indentation (no size specified) | ||
[Makefile] | ||
indent_style = tab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
DEVELOPER_ID=_____ # Please replace with your Developer-ID | ||
|
||
#PATH_CERTIFICATE=/path/to/CEZ # Optional [default: "CEZ"] | ||
#PATH_DOWNLOAD=/path/to/download # Optional [default: "."] | ||
#PATH_LOG=/path/to/log # Optional [default: "."] | ||
#PATH_VENDOR=/path/to/vendor # Optional [default: "vendor"] | ||
|
||
# Warning: | ||
# Docker interprets double quotes " literally, use single quotes ' instead. | ||
# You could escape whitespaces with backslashes \ or explicitly escape a double quote with a backslash \" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.DS_Store | ||
.vscode | ||
.idea | ||
.env | ||
cotto | ||
otto.log* | ||
*.txt | ||
download |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
* | ||
!.gitignore | ||
!.gitkeep | ||
!*.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Run `./get-test-cez-certificate.sh` or copy Test-CEZ manually here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
curl -sS -O https://download.elster.de/download/schnittstellen/Test_Zertifikate.zip && \ | ||
unzip -j Test_Zertifikate.zip eric-zertifikate-bescheidabholung/PSE/eric_private.p12 eric-zertifikate-bescheidabholung/PSE/eric_public.cer && \ | ||
rm Test_Zertifikate.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Changelog | ||
|
||
All notable changes to `cotto` will be documented in this file. | ||
|
||
## v1.0.0 - 2024-05-31 | ||
- Initial version | ||
- Utilizes Otto 40.1.8 | ||
|
||
**Full Changelog**: https://github.com/rechtlogisch/cotto/commits/v1.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
FROM --platform=linux/amd64 gcc as build | ||
COPY . /app | ||
WORKDIR /app | ||
RUN make | ||
|
||
FROM --platform=linux/amd64 ubuntu as final | ||
WORKDIR /app | ||
RUN mkdir -p /app/vendor | ||
RUN mkdir -p /app/CEZ | ||
COPY --from=build \ | ||
/app/cotto \ | ||
./ | ||
COPY --from=build \ | ||
/app/vendor/*.so \ | ||
./vendor/ | ||
COPY --from=build \ | ||
/app/CEZ/*.p12 \ | ||
/app/CEZ/*.cer \ | ||
./CEZ/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) RL Recht logisch GmbH & Co. KG open-source@rechtlogisch.de | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
.PHONY: all cotto clean | ||
|
||
PATH_VENDOR ?= $(PWD)/vendor | ||
ENV_FILE ?= .env | ||
image := rechtlogisch/cotto | ||
|
||
all: clean cotto | ||
|
||
cotto: | ||
@if [ -z "$(PATH_VENDOR)" ]; then \ | ||
echo "Error: PATH_VENDOR is not set"; \ | ||
exit 1; \ | ||
elif [ ! -d "$(PATH_VENDOR)" ]; then \ | ||
echo "Error: Directory $(PATH_VENDOR) does not exist"; \ | ||
exit 2; \ | ||
fi | ||
|
||
@if [ -z "$$(find $(PATH_VENDOR) -name '*otto.*' -print -quit)" ]; then \ | ||
echo "Error: No file matching *otto.{dll,dylib,so} found in $(PATH_VENDOR)"; \ | ||
exit 3; \ | ||
fi | ||
|
||
g++ -ldl -L"$(PATH_VENDOR)" -Wl,-rpath,"$(PATH_VENDOR)" -lotto -o cotto cotto.cpp | ||
|
||
clean: | ||
rm -f cotto otto.log* | ||
|
||
docker-build: | ||
docker build \ | ||
-t $(image) \ | ||
. | ||
|
||
docker-cmd: | ||
docker run \ | ||
-it --rm \ | ||
--env-file=$(ENV_FILE) \ | ||
--platform=linux/amd64 \ | ||
-v $(PATH_DOWNLOAD):/app/download/ \ | ||
$(image) | ||
|
||
docker-cotto: | ||
docker run \ | ||
-it --rm \ | ||
--env-file=$(ENV_FILE) \ | ||
--platform=linux/amd64 \ | ||
--name=cotto \ | ||
-v $(PATH_DOWNLOAD):/app/download/ \ | ||
$(image) \ | ||
./cotto $(input) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
![Recht logisch cotto banner image](rechtlogisch-cotto-banner.png) | ||
|
||
# cotto | ||
|
||
> Unofficial C++ Otto download demo | ||
A working example of the Otto library implementation in C++. | ||
|
||
Notice: This demo is **not intended for productive usage**! | ||
|
||
ELSTER introduced on May 27th, 2024, a new library called Otto, which can be used to download objects from OTTER (Object Storage in ELSTER). The reason why ELSTER introduced the project and library is, that the current solution hit its limits. Otto was introduced together with Datenabholung v30. The currently available way of data retrieval with ERiC will be replaced client-side with ERiC version 41 (end November 2024; only Datenabholung v30 will be available) and server-side with the planned yearly minimal version increase mid-April 2025 (exact date TBA in 2025). | ||
|
||
## Usage | ||
|
||
```bash | ||
./cotto | ||
-u objectUuid UUID of object to download (mandatory) | ||
-e extension Set filename extension of downloaded content [default: "txt"] | ||
-p password Password for certificate [default: "123456"] | ||
-f Force file overwriting [default: false] | ||
``` | ||
|
||
Examples: | ||
|
||
```bash | ||
cotto -u 2b884e20-779d-4094-a1de-8304a6fc00c9 # ESB 2014 | ||
cotto -u 131517ff-4516-418a-9167-f7e35fb32864 # ELOProtokoll | ||
``` | ||
|
||
Notice: The code and scripts have been tested so far only on Linux and macOS. Windows is pending tests. | ||
|
||
Hint: Currently, a limited list of object UUIDs is available. You can get a list of them using `PostfachAnfrage` with the Test-CEZ. | ||
|
||
## Vendor | ||
|
||
You need the official ELSTER Otto library. Download the ERiC package v40 for your platform from the [ELSTER developer area](https://www.elster.de/elsterweb/entwickler/infoseite/eric), unzip it and place it at a desired path. Feel free to place it in `./vendor/`. Currently, you only need one library: `(lib)otto.{so,dylib,dll}`, as Otto supports only client-side generated certificates (German abbreviation: CEZ). | ||
|
||
Hint: Choose the right library for the platform you compile and run on. | ||
|
||
## Compile | ||
|
||
You can compile the code with: | ||
|
||
```bash | ||
make | ||
``` | ||
|
||
Hints: provide `PATH_VENDOR` environment variable to point the path where the ELSTER `otto` library is placed on your system or place the needed libraries in `./vendor/`. | ||
|
||
Follow the steps to run `cotto` locally: | ||
|
||
```bash | ||
git clone git@github.com:rechtlogisch/cotto.git | ||
cd cotto | ||
./CEZ/get-test-cez-certificate.sh | ||
PATH_VENDOR="/path/to/otto-library/" make | ||
DEVELOPER_ID="_____" ./cotto -u 2b884e20-779d-4094-a1de-8304a6fc00c9 | ||
``` | ||
|
||
Notice: You should set your five-digit Developer-ID (German: Hersteller-ID) as the environment variable `DEVELOPER_ID`. You could source it from for example `.env` or pass it inline to `cotto`, as shown in the steps above. | ||
|
||
Hint: The downloaded result will be saved in the same directory as `cotto`, unless you provide a different `PATH_DOWNLOAD`. | ||
|
||
## Environment variables | ||
|
||
All supported environment variables are listed in [`.env.example`](.env.example). Feel free to copy them to `.env`, adjust accordingly and source for usage. | ||
|
||
## Docker | ||
|
||
A simple [Dockerfile](Dockerfile) is included. You can use `make docker-build` and `make docker-cotto` to build and run `cotto` in a container. | ||
|
||
Hint: Set `PATH_DOWNLOAD` and `PATH_LOG` environment variables to expose data outside the container. | ||
|
||
## Changelog | ||
|
||
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. | ||
|
||
## Contributing | ||
|
||
Please see [CONTRIBUTING](https://github.com/rechtlogisch/.github/blob/main/CONTRIBUTING.md) for details. | ||
|
||
## Security Vulnerabilities | ||
|
||
If you discover any security-related issues, please email open-source@rechtlogisch.de instead of using the issue tracker. | ||
|
||
## Credits | ||
|
||
- [Krzysztof Tomasz Zembrowski](https://github.com/rechtlogisch) | ||
- [All Contributors](../../contributors) | ||
|
||
## License | ||
|
||
The MIT License (MIT). Please see [License File](LICENSE.md) for more information. |
Oops, something went wrong.