Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>See below URL</strong> </p> <p><a href="https://stackoverflow.com/questions/11637905/encrypt-in-php-decrypt-in-c-sharp-wp7-silverlight-using-aes-rijndael">Encrypt in PHP, Decrypt in C# (WP7 / Silverlight) using AES / Rijndael</a></p> <p><a href="http://pumka.net/2009/12/16/rsa-encryption-cplusplus-delphi-cryptoapi-php-openssl-2/" rel="nofollow noreferrer">http://pumka.net/2009/12/16/rsa-encryption-cplusplus-delphi-cryptoapi-php-openssl-2/</a></p> <p><a href="http://www.developer.nokia.com/Community/Wiki/Encrypt-Decrypt_contacts_database_entries_using_Symbian_C%2B%2B" rel="nofollow noreferrer">http://www.developer.nokia.com/Community/Wiki/Encrypt-Decrypt_contacts_database_entries_using_Symbian_C%2B%2B</a></p> <p><strong>Read it</strong></p> <p>I droped the MD5 crap out of PHP and C#, and they are now working properly.</p> <p>Just in case you dropped here looking for the same answer, here is a sample code. Don't forget to make your own key and iv (although those bellow will work, is not recommended to use!)</p> <p><strong>PHP:</strong></p> <pre><code>function encrypt128($message) { $vector = "0000000000000000"; $key = "00000000000000000000000000000000"; $block = mcrypt_get_block_size('rijndael_128', 'cbc'); $pad = $block - (strlen($message) % $block); $message .= str_repeat(chr($pad), $pad); $cipher = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', 'cbc', ''); mcrypt_generic_init($cipher, $key, $vector); $result = mcrypt_generic($cipher, $message); mcrypt_generic_deinit($cipher); return base64_encode($result); } </code></pre> <p><strong>C++</strong></p> <p><strong>Encrypt-Decrypt contacts database entries using Symbian C++</strong></p> <p><a href="http://www.developer.nokia.com/Community/Wiki/Encrypt-Decrypt_contacts_database_entries_using_Symbian_C%2B%2B" rel="nofollow noreferrer">http://www.developer.nokia.com/Community/Wiki/Encrypt-Decrypt_contacts_database_entries_using_Symbian_C%2B%2B</a></p> <p><strong>Headers Required:</strong></p> <pre><code>#include &lt;cntdb.h&gt; // CContactDatabse, #include &lt;cntitem.h&gt; //CContactItem,CContactItemFieldSet </code></pre> <p><a href="http://www.developer.nokia.com/Community/Wiki/Encrypt-Decrypt_contacts_database_entries_using_Symbian_C%2B%2B" rel="nofollow noreferrer">http://www.developer.nokia.com/Community/Wiki/Encrypt-Decrypt_contacts_database_entries_using_Symbian_C%2B%2B</a></p> <p><strong>Encrypt Contact Fields</strong></p> <pre><code>void CEncryptContactContainer::EncryptAll() { CContactDatabase *contactDB = CContactDatabase::OpenL(); CleanupStack::PushL(contactDB); TContactIter iter(*contactDB); TContactItemId aContactId; //Developer can take Heap based descriptor for large/unknown size of contact items. TBuf16&lt;70&gt; aValue; const CContactIdArray* contactArray = contactDB-&gt;SortedItemsL(); TInt cnt=contactArray-&gt;Count(); for(TInt i=0;i&lt;cnt;i++) { CContactItem* contactItem=NULL; contactItem= contactDB-&gt;OpenContactL((*contactArray)[i]); CleanupStack::PushL(contactItem); CContactItemFieldSet&amp; fieldSet= contactItem-&gt;CardFields(); TInt fieldCount=fieldSet.Count(); // This will give number of contact fields. for(TInt index=0; index &lt; fieldCount; index++) { CContactItemField&amp; field = fieldSet[index]; const CContentType&amp; type = field.ContentType(); if(!(type.ContainsFieldType(KUidContactFieldBirthday))) { TPtrC name = contactItem-&gt;CardFields()[index].TextStorage()-&gt;Text(); aValue.Copy(name); Encrypt(aValue); // Call real encyption here contactItem-&gt;CardFields()[index].TextStorage()-&gt;SetTextL(aValue); } } //Inner for loop ends here contactDB-&gt;CommitContactL(*contactItem); CleanupStack::PopAndDestroy(contactItem); } //Outer for loop ends here CleanupStack::PopAndDestroy(contactDB); } void CEncryptContactContainer:: Encrypt (TDes&amp; aValue) { for(TInt iCount=0; iCount&lt; aValue.Length();iCount++) { aValue[iCount]+=3; } } </code></pre> <p><strong>Decrypt Contact Fields</strong></p> <pre><code>void CEncryptContactContainer::DecryptAll() { CContactDatabase *contactDB = CContactDatabase::OpenL(); CleanupStack::PushL(contactDB); TContactIter iter(*contactDB); TContactItemId aContactId; TBuf16&lt;70&gt; aValue; const CContactIdArray* contactArray = contactDB-&gt;SortedItemsL(); TInt cnt=contactArray-&gt;Count(); for(TInt i=0;i&lt;cnt;i++) { CContactItem* contactItem=NULL; contactItem= contactDB-&gt;OpenContactL((*contactArray)[i]); CleanupStack::PushL(contactItem); CContactItemFieldSet&amp; fieldSet= contactItem-&gt;CardFields(); TInt fieldCount=fieldSet.Count(); // This will give number of contact fields. for(TInt index=0; index &lt; fieldCount; index++) { CContactItemField&amp; field = fieldSet[index]; const CContentType&amp; type = field.ContentType(); if(!(type.ContainsFieldType(KUidContactFieldBirthday))) { TPtrC name = contactItem-&gt;CardFields()[index].TextStorage()-&gt;Text(); aValue.Copy(name); Decrypt(aValue); contactItem-&gt;CardFields()[index].TextStorage()-&gt;SetTextL(aValue); } } //Inner for loop ends here contactDB-&gt;CommitContactL(*contactItem); CleanupStack::PopAndDestroy(contactItem); } //Outer for loop ends here CleanupStack::PopAndDestroy(contactDB); } void CEncryptContactContainer:: Decrypt (TDes&amp; aValue) { for(TInt iCount=0; iCount&lt; aValue.Length();iCount++) { aValue[iCount]-=3; } } </code></pre> <p><strong>C#:</strong></p> <pre><code>byte[] cripted = EncryptStringToBytes("Test", System.Text.Encoding.UTF8.GetBytes("00000000000000000000000000000000"), System.Text.Encoding.UTF8.GetBytes("0000000000000000")); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload