I have written a program to encrypt and decrypt appdata in an app.config
file. The program is working correctly so I could encrypt app.config
like this
<configProtectedData>
<providers>
<add keyContainerName="MyConfigurationKey"
description="Uses RsaCryptoServiceProvider to encrypt and decrypt"
name="MyProtectedConfigurationprovider"
type="System.Configuration.RsaProtectedConfigurationProvider,System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</configProtectedData>
<appSettings configProtectionProvider="MyRSAProtectedConfigurationprovider">
<EncryptedData Type="http://www.w3.org/2001/04/xmlenc#Element"
xmlns="http://www.w3.org/2001/04/xmlenc#">
<EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc" />
<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
<EncryptedKey xmlns="http://www.w3.org/2001/04/xmlenc#">
<EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5" />
<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
<KeyName>Rsa Key</KeyName>
</KeyInfo>
<CipherData>
<CipherValue> Some long text </CipherValue>
</CipherData>
</EncryptedKey>
</KeyInfo>
<CipherData>
<CipherValue> very long text</CipherValue>
</CipherData>
</EncryptedData>
</appSettings>
After that I exported the key.Result
which is this:
<RSAKeyValue>
<Modulus>Some text</Modulus>
<Exponent>AQAB</Exponent>
<P>Some text</P>
<Q>Some text</Q>
<DP>Some text</DP>
<DQ>Some text</DQ>
<InverseQ>Some text</InverseQ>
<D>Some text</D>
</RSAKeyValue>
Now, I need to find the private key and public key in encryption. I searched several places but I could not find a proper document about it. Please help me on this.