Git Product home page Git Product logo

aws-nitro-enclaves-workshop's Introduction

AWS Nitro Enclaves Workshop

Workshop content is publicly available at https://catalog.workshops.aws/nitro-enclaves Workshop self paced execution is availble at this sub page: https://catalog.workshops.aws/nitro-enclaves/en-US/0-getting-started/0-1-self-paced

Security

See CONTRIBUTING for more information.

License Summary

The documentation is made available under the Creative Commons Attribution-ShareAlike 4.0 International License. See the LICENSE file.

The sample code within this documentation is made available under the MIT-0 license. See the LICENSE-SAMPLECODE file.

aws-nitro-enclaves-workshop's People

Contributors

amazon-auto avatar anujag24 avatar dependabot[bot] avatar itwillbebetter avatar jdbean avatar kylelaker avatar mikescops avatar omasato avatar santiagocardenas avatar xparticle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aws-nitro-enclaves-workshop's Issues

data-processing enclave application crashes when decrypting text

Hi, First off all thank you for the excellent workshop. It really helped me understand the attestation process trough KMS

One remark
When trying to decrypt plaintext information through the enclave.
the enclave crashes with the following message.

Traceback (most recent call last): File "/app/server.py", line 87, in <module> main() File "/app/server.py", line 73, in main plaintext = get_plaintext(credentials) File "/app/server.py", line 23, in get_plaintext creds = decrypt_cipher(access, secret, token, ciphertext, region) File "/app/server.py", line 51, in decrypt_cipher plaintext = json.loads(base64.b64decode(b64text)) File "/usr/lib64/python3.7/json/__init__.py", line 348, in loads return _default_decoder.decode(s) File "/usr/lib64/python3.7/json/decoder.py", line 340, in decode raise JSONDecodeError("Extra data", s, end) json.decoder.JSONDecodeError: Extra data: line 1 column 5 (char 4) child exited with error

As far as I know, this is because of line 52 in the server.py script. I don't really understand why the json.loads(plaintext) is necessary there so I just replaced it with plaintext.decode() and it works fine now.

build aws-nitro-enclaves-sdk-c fails

Step 46/51 : RUN cmake3 --build aws-nitro-enclaves-sdk-c/build --target install
---> Running in 9650115a1d96
[1/19] Building C object CMakeFiles/aws-nitro-enclaves-sdk-c.dir/source/cms.c.o
FAILED: CMakeFiles/aws-nitro-enclaves-sdk-c.dir/source/cms.c.o
/usr/bin/cc -DAWS_USE_EPOLL -DDEBUG_BUILD -DHAVE_SYSCONF -DUSE_VSOCK -I../include -Wall -Werror -Wstrict-prototypes -Wextra -pedantic -Wno-long-long -fPIC -pthread -D_ADX_ -DS2N_HAVE_EXECINFO -std=gnu99 -MD -MT CMakeFiles/aws-nitro-enclaves-sdk-c.dir/source/cms.c.o -MF CMakeFiles/aws-nitro-enclaves-sdk-c.dir/source/cms.c.o.d -o CMakeFiles/aws-nitro-enclaves-sdk-c.dir/source/cms.c.o -c ../source/cms.c
../source/cms.c: In function 'aws_cms_parse_enveloped_data':
../source/cms.c:67:10: error: too many arguments to function 'CBS_get_any_ber_asn1_element'
if (!CBS_get_any_ber_asn1_element(&cms, NULL, &tag, &tag_size, NULL) || /* ASN1_SEQ */
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../source/cms.c:10:0:
/usr/include/openssl/bytestring.h:258:20: note: declared here
OPENSSL_EXPORT int CBS_get_any_ber_asn1_element(CBS *cbs, CBS out,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../source/cms.c:78:10: error: too many arguments to function 'CBS_get_any_ber_asn1_element'
if (!CBS_get_any_ber_asn1_element(&cms, NULL, &tag, &tag_size, NULL) || / ASN1_ENUM */
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../source/cms.c:10:0:
/usr/include/openssl/bytestring.h:258:20: note: declared here
OPENSSL_EXPORT int CBS_get_any_ber_asn1_element(CBS *cbs, CBS out,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../source/cms.c:79:10: error: too many arguments to function 'CBS_get_any_ber_asn1_element'
!CBS_get_any_ber_asn1_element(&cms, NULL, &tag, &tag_size, NULL) || (tag != CBS_ASN1_SEQUENCE) || / ASN1_SEQ */
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../source/cms.c:10:0:
/usr/include/openssl/bytestring.h:258:20: note: declared here
OPENSSL_EXPORT int CBS_get_any_ber_asn1_element(CBS *cbs, CBS *out,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../source/cms.c:92:10: error: too many arguments to function 'CBS_get_any_ber_asn1_element'
if (!CBS_get_any_ber_asn1_element(&cms, &enveloped_data, &tag, &tag_size, NULL) || tag != CBS_ASN1_SET) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../source/cms.c:10:0:
/usr/include/openssl/bytestring.h:258:20: note: declared here
OPENSSL_EXPORT int CBS_get_any_ber_asn1_element(CBS *cbs, CBS *out,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../source/cms.c:140:10: error: too many arguments to function 'CBS_get_any_ber_asn1_element'
if (!CBS_get_any_ber_asn1_element(&cms, NULL, &tag, &tag_size, NULL) || (tag != CBS_ASN1_SEQUENCE) ||
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../source/cms.c:10:0:
/usr/include/openssl/bytestring.h:258:20: note: declared here
OPENSSL_EXPORT int CBS_get_any_ber_asn1_element(CBS *cbs, CBS *out,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../source/cms.c:154:10: error: too many arguments to function 'CBS_get_any_ber_asn1_element'
if (!CBS_get_any_ber_asn1_element(&cms, &content_encryption_algo, &tag, &tag_size, NULL) ||
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../source/cms.c:10:0:
/usr/include/openssl/bytestring.h:258:20: note: declared here
OPENSSL_EXPORT int CBS_get_any_ber_asn1_element(CBS *cbs, CBS out,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../source/cms.c:177:10: error: too many arguments to function 'CBS_get_any_ber_asn1_element'
if (!CBS_get_any_ber_asn1_element(&cms, NULL, &tag, &tag_size, NULL)) { / ASN1_ENUM */
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../source/cms.c:10:0:
/usr/include/openssl/bytestring.h:258:20: note: declared here
OPENSSL_EXPORT int CBS_get_any_ber_asn1_element(CBS *cbs, CBS *out,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../source/cms.c:189:12: error: too many arguments to function 'CBS_get_any_ber_asn1_element'
while (CBS_get_any_ber_asn1_element(&cms, &wrapped_encrypted_content, &tag, &tag_size, NULL) == 1 &&
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../source/cms.c:10:0:
/usr/include/openssl/bytestring.h:258:20: note: declared here
OPENSSL_EXPORT int CBS_get_any_ber_asn1_element(CBS *cbs, CBS *out,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
[2/19] Building C object CMakeFiles/aws-nitro-enclaves-sdk-c.dir/source/attestation.c.o
[3/19] Building C object CMakeFiles/aws-nitro-enclaves-sdk-c.dir/source/kms.c.o
ninja: build stopped: subcommand failed.
The command '/bin/sh -c cmake3 --build aws-nitro-enclaves-sdk-c/build --target install' returned a non-zero code: 1


I suggest updating this Dockerfile based on https://github.com/aws/aws-nitro-enclaves-sdk-c/blob/main/containers/Dockerfile.al2

KMS error. Decryption failed.

Following this:

https://nitro-enclaves.workshop.aws/en/my-first-enclave/cryptographic-attestation.html

The encrypted text could not be decrypted with error.

{
    "error": "KMS Error. Decryption Failed."
}

The ciphertext was printed on screen. When I copy it down, base64 decode it into binary, then with AWS CLI I could decrypt it okay.

I thought it was the encoding, but when I decode string.encrypted into string.encrypted.binary and use it as argument, client.py complains about unable to read it with utf-8 encoding.

I can see that the string is read and passed into enclave with no modification. KMS SDK seems to accept ciphertext directly without the binary conversion.

I'm not sure what went wrong. Please advise. Thanks!

Help with attestation

Hi! I'm trying to understand how to request the attestation document inside the enclave using python (specifically, with the user_data field populated with a custom string generated inside the enlcave). Could you please help me with this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.