Git Product home page Git Product logo

Comments (11)

b- avatar b- commented on July 23, 2024

(Let's pretend decrypted_dump, modified_dump, encrypted_dump, and key_variable are all arrays of the appropriate size, and ENCRYPT/DECRYPT are some sort of constant, or something)

from amiitool.

socram8888 avatar socram8888 commented on July 23, 2024

There already are - there is nfc3d_amiibo_unpack for decryption and nfc3d_amiibo_pack.

I wanted to make this into a static or dynamic library, but I never got around it.

from amiitool.

socram8888 avatar socram8888 commented on July 23, 2024

Okay, so let's get started. Poking also @ToolsDevelopper which may be interested in this. @HiddenRamblings is possibly relevant to this since he's the only so far which has used this library in a finished product.

Before I start converting this into a library, I need to know exactly what functions should be exposed, ie what this library should do automatically and what should be left to the developer.

For now, I was thinking in exposing the following functionality:

  • nfc3d_amiibo_create(const nfc3d_master_keys *): creates a new amiibo instance
  • amiibo_from_tag(ctx *, uint8_t *): decrypts the given data into the context, in internal format
  • amiibo_to_tag(ctx *, uint8_t *): encrypts this amiibo into the given buffer
  • amiibo_sign(ctx *): shortcut for amiibo_sign_tag followed by amiibo_sign_data
  • amiibo_sign_data(ctx *): signs the data so it's picked up as data being valid by the 3DS
  • amiibo_sign_tag(ctx *): signs the UID so it's picked up as original amiibo by the 3DS
  • amiibo_check(ctx *): shortcut for amiibo_check_data and amiibo_check_tag
  • amiibo_check_data(ctx *): checks the data signature
  • amiibo_check_tag(ctx *): checks the tag signature
  • amiibo_get_uid(ctx *): returns a pointer to the UID
  • amiibo_get_data(ctx *): returns a pointer to the data

I'm not sure if amiibo_sign_* should be exposed, or be done automatically as part of the amiibo_to_tag call. I'm not sure either if data would be more useful in the format the 3DS uses (so-called "internal format" in amiitool) or as it's stored in the tag ("tag format"

from amiitool.

jozz024 avatar jozz024 commented on July 23, 2024

@socram8888 its been 4 years so i doubt it, but any updates on this? i was looking into using rust's bindgen to use amiitool in rust, but didnt have any luck since it requires a built library iirc

from amiitool.

socram8888 avatar socram8888 commented on July 23, 2024

@jozz024 I've not looked any further. Packing up libraries in C is something I'm pretty terrified of and have stayed as far as possible from it.

The encryption is pretty basic, so if you're using Rust maybe it could be easier to just port it entirely and benefit from Rust's dependency manager.

from amiitool.

jozz024 avatar jozz024 commented on July 23, 2024

that was my next thought, have just been debating how to do it.

from amiitool.

socram8888 avatar socram8888 commented on July 23, 2024

I've never developed for Rust so I'm sorry but can't help you with the implementation.

However, if you need any aid in understanding the algorithm, or maybe the design of the API, let me know.

from amiitool.

jozz024 avatar jozz024 commented on July 23, 2024

sure, i appreciate it

from amiitool.

jozz024 avatar jozz024 commented on July 23, 2024

hey @socram8888 if its not too much trouble, can you explain what you use mbedtls for? i've found a rust port of that, but i'm still a tad confused as to what it's used for

from amiitool.

socram8888 avatar socram8888 commented on July 23, 2024

@jozz024 mbedTLS is used for:

  • Calculating a HMAC-SHA256 as part of the DRBG
  • Checking and generating the fixed part HMAC-SHA256
  • Checking and generating the user content's HMAC-SHA256
  • Decrypting and encrypting the user contents using AES

There's no reason why to use mbedTLS. I used that because it was pretty small and I did not have to deal with the hassle of compiling against a dynamic library such as OpenSSL.

from amiitool.

jozz024 avatar jozz024 commented on July 23, 2024

wow it's been 6 months alr
i finally have a semi working rust amiibo library (https://github.com/jozz024/amiibo-rs) but atm i'm facing issues with lock 💀
i think i'm doing something with the hmac calculation wrong, but i just thought i'd update since i came to check the repo if i did anything wrong

from amiitool.

Related Issues (9)

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.