intel / cryptography-primitives

Apache License 2.0
319 stars 86 forks source link

any samples for this repo? #4

Closed eaglesharkmayonnaise closed 5 years ago

eaglesharkmayonnaise commented 5 years ago
  1. Symmetric Cryptography Primitive Functions (AES, SM4, TDES, RC4)
  2. One-Way Hash Primitives (SHA, MD5, SM3)
  3. Data Authentication Primitive Functions (HMAC, CMAC)
  4. Public Key Cryptography Functions (RSA, DLP, ECC)
  5. Finite Field Arithmetic Functions
eaglesharkmayonnaise commented 5 years ago

ping @yuriynat-int @VasiliyR

PavelBerdnikOFF commented 5 years ago

Hello, yes we are planning to add samples. You provided a list of ciphers you would like to have samples - thank you. What kind of the samples you would like to have?

eaglesharkmayonnaise commented 5 years ago

rsa 👍 I have tried porting from the following projects:

  1. SGXDataCenterAttestationPrimitives
  2. keystore
  3. clang_sgx_sdk_v2.5

but Obviously I failed. 😂

akryeem-INTC commented 5 years ago

You may take a look at: https://github.com/intel/linux-sgx/tree/master/sdk/tlibcrypto It has crypto operations implemented in both IPP and SgxSSL (OpenSSL APIs). It could help.

Thanks, Alaa

eaglesharkmayonnaise commented 5 years ago

@akryeem-INTC
yes i already tried this. and I have modified it and made it simple enough. But I don't know how to pass parameters. ippctest.zip password:123. I hope to have a simpler api, such as:

void rsa_init();

// Of course we can set the length, 2048/3072/4096 etc.
bool get_public_private_key(char* publicKey, char* privateKey);

const char* get_encrypt_buffer(const char* publicKey, const char* Buffer);

const char* get_decrypt_buffer(const char* privateKey, const char* Buffer);

so we can do this:

int main() {
    char buf = "this is message test"
    rsa_init();
    char pubKey[100000];
    char prvKey[100000];
    get_public_private_key(pubKey, prvKey);

    auto cipherText = get_encrypt_buffer(pubKey, buf);

    auto plaintext = get_decrypt_buffer(prvKey, cipherText);

    printf_s("%s\n",plaintext);
}
amatyuko commented 5 years ago

Hi @xoraxrax,

Sorry for the late reply. We're working on examples and plan to publish several of them (including RSA) next week or so. There are plans to extend the functionality that is covered by examples even more later. Hopefully it is still actual for you.

Regards, Andrey

amatyuko commented 5 years ago

Hi @xoraxrax, all,

We have added several examples for RSA and AES, and we plan to add more examples later. Should you have any feedback or suggestions which ones you want to see here first, feel free to ask.

Regards, Andrey