{"action":"created","issue":{"url":"https://api.github.com/repos/AArnott/PCLCrypto/issues/61","repository_url":"https://api.github.com/repos/AArnott/PCLCrypto","labels_url":"https://api.github.com/repos/AArnott/PCLCrypto/issues/61/labels{/name}","comments_url":"https://api.github.com/repos/AArnott/PCLCrypto/issues/61/comments","events_url":"https://api.github.com/repos/AArnott/PCLCrypto/issues/61/events","html_url":"https://github.com/AArnott/PCLCrypto/issues/61","id":125144246,"number":61,"title":"Encryption/Decryption code breaks on Android 6 Marshmallow (NetFxCrypto.DeriveBytes.GetBytes)","user":{"login":"rsnitsch","id":1746428,"avatar_url":"https://avatars.githubusercontent.com/u/1746428?v=3","gravatar_id":"","url":"https://api.github.com/users/rsnitsch","html_url":"https://github.com/rsnitsch","followers_url":"https://api.github.com/users/rsnitsch/followers","following_url":"https://api.github.com/users/rsnitsch/following{/other_user}","gists_url":"https://api.github.com/users/rsnitsch/gists{/gist_id}","starred_url":"https://api.github.com/users/rsnitsch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rsnitsch/subscriptions","organizations_url":"https://api.github.com/users/rsnitsch/orgs","repos_url":"https://api.github.com/users/rsnitsch/repos","events_url":"https://api.github.com/users/rsnitsch/events{/privacy}","received_events_url":"https://api.github.com/users/rsnitsch/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/AArnott/PCLCrypto/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-01-06T09:51:14Z","updated_at":"2016-02-04T13:50:11Z","closed_at":null,"body":"My encryption/decryption code works perfectly fine up to Android 5.x, but on Android 6 Marshmallow the code doesn't work anymore. The root cause seems to be that the keysize changes from 32 bytes (Android 5) to 16 bytes (Android 6). It seems that the `NetFxCrypto.DeriveBytes.GetBytes` method does not return the correct number of bytes on Android 6.\r\n\r\nI am using the following code to derive the keymaterial (the salt has 8 bytes):\r\n\r\n    // Returns 32 bytes on Android 5 and 16 bytes on Android 6.\r\n    private byte[] deriveKeyMaterialFromPassword(string password, byte[] salt)\r\n    {\r\n        const int numIterations = 500;\r\n        return NetFxCrypto.DeriveBytes.GetBytes(password, salt, numIterations, 256 / 8);\r\n    }\r\n\r\n### Further information\r\n\r\nAndroid 5 device: Google Nexus 4 (Android version 5.1.1)\r\nAndroid 6 device: Google Nexus 5 (Android version 6.0.1)\r\n\r\n### Possibly related links\r\n\r\nAccording to this post on stackoverflow, the default crypto provider was changed in Android 6 from \"BC\" to \"AndroidOpenSSL\":\r\n- http://stackoverflow.com/a/34307500\r\n\r\nI could not find any official information about this, however. But I have found a related bug report in the Google Android bugtracker:\r\n- Triple DES Encryption generating different Output (https://code.google.com/p/android/issues/detail?id=189292)"},"comment":{"url":"https://api.github.com/repos/AArnott/PCLCrypto/issues/comments/179848674","html_url":"https://github.com/AArnott/PCLCrypto/issues/61#issuecomment-179848674","issue_url":"https://api.github.com/repos/AArnott/PCLCrypto/issues/61","id":179848674,"user":{"login":"rsnitsch","id":1746428,"avatar_url":"https://avatars.githubusercontent.com/u/1746428?v=3","gravatar_id":"","url":"https://api.github.com/users/rsnitsch","html_url":"https://github.com/rsnitsch","followers_url":"https://api.github.com/users/rsnitsch/followers","following_url":"https://api.github.com/users/rsnitsch/following{/other_user}","gists_url":"https://api.github.com/users/rsnitsch/gists{/gist_id}","starred_url":"https://api.github.com/users/rsnitsch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rsnitsch/subscriptions","organizations_url":"https://api.github.com/users/rsnitsch/orgs","repos_url":"https://api.github.com/users/rsnitsch/repos","events_url":"https://api.github.com/users/rsnitsch/events{/privacy}","received_events_url":"https://api.github.com/users/rsnitsch/received_events","type":"User","site_admin":false},"created_at":"2016-02-04T13:50:11Z","updated_at":"2016-02-04T13:50:11Z","body":"We are planning to release an app soon, but this issue is a blocker for us. For this reason, I would like to ask you how long you think we will have to wait for you to deal with this issue.\r\n\r\nBest regards,\r\nRobert"}}