https://github.com/awslabs/aws-crt-cpp

C++ wrapper around the aws-c-* libraries. Provides Cross-Platform Transport Protocols and SSL/TLS implementations for C++.

https://github.com/awslabs/aws-crt-cpp

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    1 of 43 committers (2.3%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.5%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

C++ wrapper around the aws-c-* libraries. Provides Cross-Platform Transport Protocols and SSL/TLS implementations for C++.

Basic Info
  • Host: GitHub
  • Owner: awslabs
  • License: apache-2.0
  • Language: C++
  • Default Branch: main
  • Size: 5.62 MB
Statistics
  • Stars: 82
  • Watchers: 19
  • Forks: 71
  • Open Issues: 7
  • Releases: 0
Created over 7 years ago · Last pushed 10 months ago
Metadata Files
Readme Contributing License Code of conduct Notice

README.md

AWS Crt Cpp

C++ wrapper around the aws-c-* libraries. Provides Cross-Platform Transport Protocols and SSL/TLS implementations for C++.

Documentation

https://awslabs.github.io/aws-crt-cpp/

Currently Included:

  • aws-c-common: Cross-platform primitives and data structures.
  • aws-c-io: Cross-platform event-loops, non-blocking I/O, and TLS implementations.
  • aws-c-mqtt: MQTT client.
  • aws-c-auth: Auth signers such as Aws-auth sigv4
  • aws-c-http: HTTP 1.1 client, and websockets (H2 coming soon)
  • aws-checksums: Cross-Platform HW accelerated CRC32c and CRC32 with fallback to efficient SW implementations.
  • aws-c-event-stream: C99 implementation of the vnd.amazon.event-stream content-type.

More protocols and utilities are coming soon, so stay tuned.

Building

The C99 libraries are already included for your convenience as submodules. You should perform a recursive clone git clone --recursive or initialize the submodules via git submodule update --init. These dependencies are compiled by CMake as part of the build process.

If you want to manage these dependencies manually (e.g. you're using them in other projects), configure CMake with -DBUILD_DEPS=OFF and -DCMAKE_PREFIX_PATH=<install> pointing to the absolute path where you have them installed.

MSVC

If you want to use a statically linked MSVCRT (/MT, /MTd), you can add -DAWS_STATIC_MSVC_RUNTIME_LIBRARY=ON to your cmake configuration.

Apple Silicon (aka M1) and Universal Binaries

aws-crt-cpp supports both arm64 and x86_64 architectures. Configure cmake with -DCMAKE_OSX_ARCHITECTURES=arm64 to target Apple silicon, or -DCMAKE_OSX_ARCHITECTURES=x86_64 to target Intel. If you wish to create a universal binary, you should use lipo to combine the x86_64 and arm64 binaries. For example: lipo -create -output universal_app x86_app arm_app

You SHOULD NOT build for both architectures simultaneously via -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64". aws-crt-cpp has not been tested in this configuration. aws-crt-cpp's cmake configuration scripts are known to get confused by this, and will not enable optimizations that would benefit an independent arm64 or x86_64 build.

OpenSSL and LibCrypto (Unix only)

If your application uses OpenSSL, configure with -DUSE_OPENSSL=ON.

aws-crt-cpp does not use OpenSSL for TLS. On Apple and Windows devices, the OS's default TLS library is used. On Unix devices, s2n-tls is used. But s2n-tls uses libcrypto, the cryptography math library bundled with OpenSSL. To simplify the build process, the source code for s2n-tls and libcrypto are included as git submodules and built along with aws-crt-cpp. But if your application is also loading the system installation of OpenSSL (i.e. your application uses libcurl which uses libssl which uses libcrypto) there may be crashes as the application tries to use two different versions of libcrypto at once.

Setting -DUSE_OPENSSL=ON will cause aws-crt-cpp to link against your system's existing libcrypto, instead of building its own copy.

You can ignore all this on Windows and Apple platforms, where aws-crt-cpp uses the OS's default libraries for TLS and cryptography math.

Dependencies?

There are no non-OS dependencies that AWS does not own, maintain, and ship.

Common Usage

To do anything with IO, you'll need to create a few objects that will be used by the rest of the library.

For example:

Aws::Crt::LoadErrorStrings();

Will load error strings for debugging purposes. Since the C libraries use error codes, this will allow you to print the corresponding error string for each error code.

Aws::Crt::ApiHandle apiHandle; This performs one-time static initialization of the library. You'll need it to do anything, so don't forget to create one.

Aws::Crt::Io::EventLoopGroup eventLoopGroup(<number of threads you want>); To use any of our APIs that perform IO you'll need at least one event-loop. An event-loop group is a collection of event-loops that protocol implementations will load balance across. If you won't have very many connections (say, more than 100 or so), then you most likely only want 1 thread. In this case, you want to pass a single instance of this to every client or server implementation of a protocol you use in your application. In some advanced use cases, you may want to reserve a thread for different types of IO tasks. In that case, you can have an instance of this class for each reservation.

```` Aws::Crt::Io::TlsContextOptions tlsCtxOptions = Aws::Crt::Io::TlsContextOptions::InitClientWithMtls(certificatePath.cstr(), keyPath.cstr()); /* * If we have a custom CA, set that up here. */ if (!caFile.empty()) { tlsCtxOptions.OverrideDefaultTrustStore(nullptr, caFile.c_str()); }

uint32_t port = 8883;
if (Io::TlsContextOptions::IsAlpnSupported())
{
    /*
    * Use ALPN to negotiate the mqtt protocol on a normal
    * TLS port if possible.
    */
    tlsCtxOptions.SetAlpnList("x-amzn-mqtt-ca");
    port = 443;
}

Aws::Crt::Io::TlsContext tlsCtx(tlsCtxOptions, Io::TlsMode::CLIENT);

````

If you plan on using TLS, you will need a TlsContext. These are NOT CHEAP, so use as few as possible to perform your task. If you're in client mode and not doing anything fancy (e.g. mutual TLS), then you can likely get away with using a single instance for the entire application.

Aws::Crt::Io::ClientBootstrap bootstrap(eventLoopGroup);

Lastly, you will need a client or server bootstrap to use a client or server protocol implementation. Since everything is non-blocking and event driven, this handles most of the "callback hell" inherent in the design. Assuming you aren't partitioning threads for particular use-cases, you can have a single instance of this that you pass to multiple clients.

Mac-Only TLS Behavior

Please note that on Mac, once a private key is used with a certificate, that certificate-key pair is imported into the Mac Keychain. All subsequent uses of that certificate will use the stored private key and ignore anything passed in programmatically. Beginning in v0.8.10, when a stored private key from the Keychain is used, the following will be logged at the "info" log level:

static: certificate has an existing certificate-key pair that was previously imported into the Keychain. Using key from Keychain instead of the one provided.

License

This library is licensed under the Apache 2.0 License.

Owner

  • Name: Amazon Web Services - Labs
  • Login: awslabs
  • Kind: organization
  • Location: Seattle, WA

AWS Labs

Committers

Last synced: about 2 years ago

All Time
  • Total Commits: 513
  • Total Committers: 43
  • Avg Commits per committer: 11.93
  • Development Distribution Score (DDS): 0.649
Past Year
  • Commits: 97
  • Committers: 16
  • Avg Commits per committer: 6.063
  • Development Distribution Score (DDS): 0.608
Top Committers
Name Email Commits
Bret Ambrose b****e@g****m 180
Michael Graeb g****m@a****m 63
Jonathan M. Henson h****o@a****m 41
Justin Boswell b****j@a****m 32
xiazhvera z****a@a****m 19
TwistedTwigleg n****d@a****m 16
Dengke Tang 8****5@q****m 15
Jonathan M. Henson j****n@g****m 13
Dengke Tang d****t@a****m 12
Igor Abdrakhimov o****c@g****m 12
Waqar Ahmed Khan w****7@g****m 10
Dmitriy Musatkin 6****n 9
Ryan Carper 5****r 9
SergeyRyabinin s****k@g****m 8
James Siri j****i@a****m 7
Pushen Wang w****0@h****m 7
ilevyor 8****r 6
Steve Kim 8****K 6
Justin Boswell j****l@g****m 5
Andrew Tang t****r@a****m 5
David Oguns 3****S 5
Damian Vicino s****r 4
Joseph Klix j****l@a****m 3
sbiscigl s****l@a****m 3
Alfred G 2****g 3
Pushen Wang w****h@a****m 2
Guilherme Quentel Melo g****o@g****m 2
Massimiliano Angelino 3****g 1
Janno Stern j****n 1
Yasmine Talby 1****y 1
and 13 more...
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 19
  • Total pull requests: 480
  • Average time to close issues: 3 months
  • Average time to close pull requests: about 1 month
  • Total issue authors: 15
  • Total pull request authors: 38
  • Average comments per issue: 3.21
  • Average comments per pull request: 0.16
  • Merged pull requests: 382
  • Bot issues: 0
  • Bot pull requests: 2
Past Year
  • Issues: 4
  • Pull requests: 175
  • Average time to close issues: 4 days
  • Average time to close pull requests: 4 days
  • Issue authors: 4
  • Pull request authors: 15
  • Average comments per issue: 1.25
  • Average comments per pull request: 0.05
  • Merged pull requests: 139
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • nabelekt (3)
  • nunotexbsd (2)
  • Hadatko (2)
  • thomas-roos (1)
  • g76r (1)
  • NEIL-smtg (1)
  • M-Pixel (1)
  • boquan-fang (1)
  • kareali (1)
  • jacky96623 (1)
  • mkaranki (1)
  • muboheng (1)
  • rafaelBauer (1)
  • ilya-lsky (1)
  • daeho-ro (1)
Pull Request Authors
  • bretambrose (171)
  • graebm (44)
  • sfod (42)
  • DmitriyMusatkin (39)
  • xiazhvera (36)
  • waahm7 (24)
  • sbSteveK (17)
  • sbiscigl (17)
  • TingDaoK (16)
  • TwistedTwigleg (13)
  • SergeyRyabinin (10)
  • alfred2g (4)
  • jmklix (4)
  • alexw91 (3)
  • sbera87 (3)
Top Labels
Issue Labels
bug (13) needs-triage (6) response-requested (4) closing-soon (3) p2 (3) closed-for-staleness (2) CRT/SDK (1) CRT/IoT (1) pending-release (1) p3 (1) guidance (1) feature-request (1) potential-regression (1)
Pull Request Labels
Cmake (2) pr/needs-review (1) CRT/IoT (1)

Packages

  • Total packages: 15
  • Total downloads:
    • homebrew 8,194 last-month
  • Total dependent packages: 375
    (may contain duplicates)
  • Total dependent repositories: 23
    (may contain duplicates)
  • Total versions: 197
  • Total maintainers: 3
alpine-v3.18: aws-crt-cpp

C++ wrapper around the aws-c-* libraries. Provides Cross-Platform Transport Protocols and SSL/TLS implementations for C++

  • Versions: 6
  • Dependent Packages: 371
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 9.2%
Forks count: 15.5%
Stargazers count: 21.4%
Maintainers (1)
Last synced: 10 months ago
alpine-v3.18: aws-crt-cpp-dev

C++ wrapper around the aws-c-* libraries. Provides Cross-Platform Transport Protocols and SSL/TLS implementations for C++ (development files)

  • Versions: 6
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 9.2%
Forks count: 15.5%
Stargazers count: 21.4%
Maintainers (1)
Last synced: 10 months ago
alpine-edge: aws-crt-cpp

C++ wrapper around the aws-c-* libraries. Provides Cross-Platform Transport Protocols and SSL/TLS implementations for C++

  • Versions: 44
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Average: 13.6%
Dependent packages count: 14.6%
Forks count: 16.9%
Stargazers count: 23.1%
Maintainers (1)
Last synced: 10 months ago
alpine-edge: aws-crt-cpp-dev

C++ wrapper around the aws-c-* libraries. Provides Cross-Platform Transport Protocols and SSL/TLS implementations for C++ (development files)

  • Versions: 44
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Average: 13.6%
Dependent packages count: 14.6%
Forks count: 16.9%
Stargazers count: 23.1%
Maintainers (1)
Last synced: 10 months ago
conda-forge.org: aws-crt-cpp
  • Versions: 62
  • Dependent Packages: 1
  • Dependent Repositories: 23
Rankings
Dependent repos count: 7.6%
Average: 25.4%
Forks count: 25.7%
Dependent packages count: 29.0%
Stargazers count: 39.2%
Last synced: 10 months ago
formulae.brew.sh: aws-crt-cpp

C++ wrapper around the aws-c-* libraries

  • Versions: 21
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 8,194 Last month
Rankings
Dependent packages count: 17.9%
Average: 45.5%
Dependent repos count: 52.0%
Downloads: 66.5%
Last synced: 10 months ago
anaconda.org: aws-crt-cpp

C++ wrapper around the aws-c-* libraries. Provides Cross-Platform Transport Protocols and SSL/TLS implementations for C++.

  • Versions: 4
  • Dependent Packages: 3
  • Dependent Repositories: 0
Rankings
Dependent packages count: 50.6%
Average: 55.0%
Dependent repos count: 59.5%
Last synced: 10 months ago
alpine-v3.21: aws-crt-cpp

C++ wrapper around the aws-c-* libraries. Provides Cross-Platform Transport Protocols and SSL/TLS implementations for C++

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Maintainers (1)
Last synced: 10 months ago
alpine-v3.22: aws-crt-cpp

C++ wrapper around the aws-c-* libraries. Provides Cross-Platform Transport Protocols and SSL/TLS implementations for C++

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Maintainers (1)
Last synced: 10 months ago
alpine-v3.21: aws-crt-cpp-dev

C++ wrapper around the aws-c-* libraries. Provides Cross-Platform Transport Protocols and SSL/TLS implementations for C++ (development files)

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Maintainers (1)
Last synced: 10 months ago
alpine-v3.20: aws-crt-cpp

C++ wrapper around the aws-c-* libraries. Provides Cross-Platform Transport Protocols and SSL/TLS implementations for C++

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Last synced: 10 months ago
alpine-v3.22: aws-crt-cpp-dev

C++ wrapper around the aws-c-* libraries. Provides Cross-Platform Transport Protocols and SSL/TLS implementations for C++ (development files)

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Maintainers (1)
Last synced: 10 months ago
alpine-v3.19: aws-crt-cpp

C++ wrapper around the aws-c-* libraries. Provides Cross-Platform Transport Protocols and SSL/TLS implementations for C++

  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Last synced: 10 months ago
alpine-v3.20: aws-crt-cpp-dev

C++ wrapper around the aws-c-* libraries. Provides Cross-Platform Transport Protocols and SSL/TLS implementations for C++ (development files)

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Last synced: 10 months ago
alpine-v3.19: aws-crt-cpp-dev

C++ wrapper around the aws-c-* libraries. Provides Cross-Platform Transport Protocols and SSL/TLS implementations for C++ (development files)

  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Dependent packages count: 0.0%
Average: 100%
Last synced: 10 months ago

Dependencies

.github/workflows/ci.yml actions
  • actions/checkout v3 composite
  • awslabs/aws-crt-builder/.github/actions/check-submodules main composite
.github/workflows/closed-issue-message.yml actions
  • aws-actions/closed-issue-message v1 composite
.github/workflows/docs.yml actions
  • actions/checkout v3 composite
  • ad-m/github-push-action v0.6.0 composite
.github/workflows/handle-stale-discussions.yml actions
  • aws-github-ops/handle-stale-discussions v1 composite
.github/workflows/lint.yml actions
  • DoozyX/clang-format-lint-action v0.13 composite
  • actions/checkout v1 composite
.github/workflows/release.yml actions
  • actions/checkout v3 composite
.github/workflows/stale_issue.yml actions
  • aws-actions/stale-issue-cleanup v3 composite