I have one project [out-sourced] which ask me for "The project includes a password-encrypted key used for signing".
Its window application having 5-6 sub project and its in Orcas., while loading the project its show me the dialouge to enter passoword, if I escape then while building application it ask for same and build gets failed, with error Error 1 Importing key file
"abc.bbc.Data.pfx" was canceled. [as I press escape on dialouge box]
public class CryptorEngine
{
/// <summary>
/// Encrypt a string using dual encryption method. Return a encrypted cipher Text
/// </summary>
/// <param name="toEncrypt">string to be encrypted</param>
/// <param name="useHashing">use hashing? send to for extra secirity</param>
/// <returns></returns>
public static string Encrypt(string toEncrypt, bool useHashing)
{
byte[] keyArray;
byte[] toEncryptArray = UTF8Encoding.UTF8.GetBytes(
toEncrypt);
// System.Configuration.AppSettingsReader settingsReader = new AppSettingsReader();
// Get the key from config file
// string key = (string)settingsReader.GetValue("rakhicrypto", typeof(String));
string key = "rakhicrypto";
//System.Windows.Forms.MessageBox.Show(key);
if (useHashing)
{
MD5CryptoServiceProvider hashmd5 = new MD5CryptoServiceProvider();
keyArray = hashmd5.ComputeHash(UTF8Encoding.UTF8.GetBytes(key));
hashmd5.Clear();
}
else
keyArray = UTF8Encoding.UTF8.GetBytes(key);
bhadelia.imr...
Contributor
3191 Points
533 Posts
Need help on password-encrypted key used for signing.
Sep 01, 2008 05:00 AM|LINK
Hello Friends,
I have one project [out-sourced] which ask me for "The project includes a password-encrypted key used for signing".
Its window application having 5-6 sub project and its in Orcas., while loading the project its show me the dialouge to enter passoword, if I escape then while building application it ask for same and build gets failed, with error Error 1 Importing key file "abc.bbc.Data.pfx" was canceled. [as I press escape on dialouge box]
Any comment any suggession any solutions?
[MCTS]
Born to fly High
http://knowledgebaseworld.blogspot.com/
saminathan.m...
Member
342 Points
61 Posts
Re: Need help on password-encrypted key used for signing.
Sep 01, 2008 10:31 AM|LINK
string l_TempPassword = CryptorEngine.Encrypt(
public class CryptorEngine{
/// <summary>
/// Encrypt a string using dual encryption method. Return a encrypted cipher Text
/// </summary>
/// <param name="toEncrypt">string to be encrypted</param>
/// <param name="useHashing">use hashing? send to for extra secirity</param>
/// <returns></returns>
public static string Encrypt(string toEncrypt, bool useHashing)
{
byte[] keyArray;
byte[] toEncryptArray = UTF8Encoding.UTF8.GetBytes(
// System.Configuration.
// Get the key from config file
// string key = (string)settingsReader.
string key = "rakhicrypto";
//System.Windows.Forms.
if (useHashing)
{
MD5CryptoServiceProvider hashmd5 = new MD5CryptoServiceProvider();
keyArray = hashmd5.ComputeHash(
hashmd5.Clear();
}
else
keyArray = UTF8Encoding.UTF8.GetBytes(
TripleDESCryptoServiceProvider tdes = new TripleDESCryptoServiceProvider
tdes.Key = keyArray;
tdes.Mode = CipherMode.ECB;
tdes.Padding = PaddingMode.PKCS7;
ICryptoTransform cTransform = tdes.CreateEncryptor();
byte[] resultArray = cTransform.
tdes.Clear();
return Convert.ToBase64String(
}
/// <summary>
/// DeCrypt a string using dual encryption method. Return a DeCrypted clear string
/// </summary>
/// <param name="cipherString">encrypted string</param>
/// <param name="useHashing">Did you use hashing to encrypt this data? pass true is yes</param>
/// <returns></returns>
public static string Decrypt(string cipherString, bool useHashing)
{
byte[] keyArray;
byte[] toEncryptArray = Convert.FromBase64String(
// System.Configuration.
//Get your key from config file to open the lock!
//string key = (string)settingsReader.
string key = "rakhicrypto";
if (useHashing)
{
MD5CryptoServiceProvider hashmd5 = new MD5CryptoServiceProvider();
keyArray = hashmd5.ComputeHash(
hashmd5.Clear();
}
else
keyArray = UTF8Encoding.UTF8.GetBytes(
TripleDESCryptoServiceProvider tdes = new TripleDESCryptoServiceProvider
tdes.Key = keyArray;
tdes.Mode = CipherMode.ECB;
tdes.Padding = PaddingMode.PKCS7;
ICryptoTransform cTransform = tdes.CreateDecryptor();
byte[] resultArray = cTransform.
tdes.Clear();
return UTF8Encoding.UTF8.GetString(
}
}
Saminathan.N
bhadelia.imr...
Contributor
3191 Points
533 Posts
Re: Need help on password-encrypted key used for signing.
Sep 01, 2008 12:13 PM|LINK
Hi,
Thanks Saminathan for the reply,
But I dont think this is the solution that I am looking for, When I open the solution at that time its asking for password.
What I need is to remove that password dialouge box.
[MCTS]
Born to fly High
http://knowledgebaseworld.blogspot.com/
niksv
Contributor
5925 Points
1115 Posts
Re: Need help on password-encrypted key used for signing.
Jan 24, 2011 08:35 AM|LINK
Open the project properties -> signing
UnCheck options:
1. Sign the clickonce manifests
2. Sign the assembly
Save the project and build the solution. Then re-open it will not promp for password anymore.
FarhanAbdulW...
Member
2 Points
1 Post
Re: Need help on password-encrypted key used for signing.
May 08, 2013 08:26 AM|LINK
Thanks, it is working.
niksv
Contributor
5925 Points
1115 Posts
Re: Need help on password-encrypted key used for signing.
May 09, 2013 01:00 PM|LINK
Mark it as answer whichever solution worked for you.