1

Closed

Add support for importing/entering RsaParameter information

description

Need a way to import RsaParameter information. I have a project in which I get the exponent and modulus from a server request. Once I have the params, they need to be imported into an ICryptographicKey.

Example:
public class PublicKey
{
    public string Exponent { get; set; }
    public string Modulus { get; set; }
}

private byte[] Encrypt(PublicKey key, string data)
{
    IAsymmetricKeyAlgorithmProvider provider = PCLCrypto.WinRTCrypto.AsymmetricKeyAlgorithmProvider.OpenAlgorithm(AsymmetricAlgorithm.RsaSignPssSha512);
    ICryptographicKey keyPair = provider.CreateKeyPair(512);
    keyPair.SetKey(key.Exponent, key.Modulus);
    var bytes = PCLCrypto.WinRTCrypto.CryptographicEngine.Encrypt(cryptographicKey, Encoding.UTF8.GetBytes(data));
    return bytes;
}
Closed Jun 16, 2014 at 1:44 AM by AArnott
Fixed in 0.5.1.

comments