Skip to content
This repository has been archived by the owner on Apr 1, 2024. It is now read-only.

Using SymmetricKeyAlgorithmProvider in PCL codebase ios #10

Closed
pricimus opened this issue Feb 10, 2015 · 2 comments
Closed

Using SymmetricKeyAlgorithmProvider in PCL codebase ios #10

pricimus opened this issue Feb 10, 2015 · 2 comments

Comments

@pricimus
Copy link

Hi,

I have the following method:

        public string Encrypt(string stringToEncrypt, string cryptoKey)
    {
        byte[] keyMaterial = System.Text.Encoding.UTF8.GetBytes (cryptoKey);
        byte[] data = System.Text.Encoding.UTF8.GetBytes (stringToEncrypt);
        var provider =          WinRTCrypto.SymmetricKeyAlgorithmProvider.OpenAlgorithm(SymmetricAlgorithm.AesCbcPkcs7);
        var key = provider.CreateSymmetricKey (keyMaterial);
        byte[] cipherText = WinRTCrypto.CryptographicEngine.Encrypt(key, data);

        return Convert.ToBase64String (cipherText);
    }

The line var provider = WinRTCrypto.SymmetricKeyAlgorithmProvider.OpenAlgorithm(SymmetricAlgorithm.AesCbcPkcs7); fails with error System.NotImplementedException: Not implemented in reference assembly

I'm confused as I thought the point of the library was to provide cryptographic support for codebases that use the PCL. Is SymmetricKeyAlgorithmProvider not available to PCL codebases? And if not, what is the way to encrypt/decrypt strings on iOS devices?

@AArnott
Copy link
Owner

AArnott commented Feb 10, 2015

@pricimus
Copy link
Author

That's not solved it unfortunately.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants