• dotNetkow
  • NEWBIE
  • 25 Points
  • Member since 2011

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 8
    Replies

Full code over at: Stack Overflow

 

Basically, I've encrypted a value in Salesforce using AES 256.  When I try to decrypt it via C#, I see a Padding error.  The exact same question was posted a few months ago, but no response (  Does anyone have any idea? I'm quite stumped.   thanks!

My Remote Access application is ready for Production use by clients.  What is the best practice for an application that will be used by multiple clients?  Should I "host" the remote access entry in my company's Production Salesforce instance, or have each Client set up a new remote access entry for my app?

 

I don't see anything specific that Salesforce recommends, so any insight would be much appreciated!

As shown here in Step Two of the Quick Start section, one should be able to get an access token by simply using the username/password combination.  When I went to a session on the REST API during Dreamforce 2011, this was a valid approach.  Now, we have to append the user's security token to the password.  Is it possible to avoid using the security token, or has Salesforce changed this for good?

 

UPDATE:

From the Digging Deeper into Oauth 2.0 page, found out that the security token is necessary unless "the client's IP address has been whitelisted in your org".  Adding a new trusted IP address range can be done via Setup -> Administration Setup -> Security Controls -> Network Access.

I'd like to create a custom Salesforce application that uses Oauth and embed it within another application.  To do so, I need to iframe my Salesforce app from within the other one.  Is there any way to iframe in https://login.salesforce.com?  It appears as though the page detects and blocks this.

Using this guide as a reference, I've created a Remote Access application entry in my developer account.

I'd like to play around with the Authorization screen that the user should see after navigating to this URL:

 

https://login.salesforce.com/services/oauth2/authorize?response_type=code&client_id=<your_client_id>&redirect_uri=<your_redirect_uri>

 

When I fill in the right values and navigate to the URL, I am not taken to the screen that I expect to see here, but rather the regular Salesforce login screen.  What am I getting wrong?  Thanks.

I have a method that I need to unit test which retrieves a Static Resource object based on the name of the file passed to the method.  In the unit test, I'd like to insert a new Static Resource, like so:

 

Blob b = Blob.valueOf('file contents here');       
StaticResource resource = new StaticResource(Body=b,Name='testFileName');       
insert resource;

// call method to test with newly created Static Resource
string result = methodToTest('testFileName');

 

 However, it fails when trying to insert the static resource.  How else can I insert it?  Thanks.

I need to embed a VF page into the Home page tab.  So far I have made a HTML area component under Home Page Components.  Within the component, I use this to iframe in the VF page:

 

<iframe src="/apex/My_VF_Page"></iframe>

 

However, the result shows the entire page, not just the VF page:

 

 

So the question is, how do I just display the VF page's content?

 

Full code over at: Stack Overflow

 

Basically, I've encrypted a value in Salesforce using AES 256.  When I try to decrypt it via C#, I see a Padding error.  The exact same question was posted a few months ago, but no response (  Does anyone have any idea? I'm quite stumped.   thanks!

Ok, so I have a webservice hosted outside of Salesforce that is called from one of our pages within Salesforce. Within this webservice is a field that we need to encrypt before sending it over the wire. I am able to encrypt it but I just keep getting the "Given final block not properly padded" error message when I try to decrypt it in Salesforce. If someone can please take a look at my code and let me know whether the issue lies in my .NET code where I am encrypting it or in my Apex code where I am decrypting it, I would be eternally grateful.

 

My .NET code:

public static string Encrypt_AES(string text)
{
    if (text == null || text.Length <= 0)
    {
        throw new ArgumentNullException("plainText");
    }

    byte[] encrypted;

    using (AesCryptoServiceProvider aesAlg = new AesCryptoServiceProvider())
    {
        aesAlg.Key = System.Text.Encoding.UTF8.GetBytes("ABC123DEF456HIJ789KLM012NOP345QR");
        aesAlg.IV = System.Text.Encoding.UTF8.GetBytes("ABC123DEF456HIJ7");
        aesAlg.Mode = CipherMode.CBC;
        aesAlg.Padding = PaddingMode.PKCS7;

        ICryptoTransform encryptor = aesAlg.CreateEncryptor(aesAlg.Key, aesAlg.IV);

        using (MemoryStream ms = new MemoryStream())
        {
            using (CryptoStream cs = new CryptoStream(ms, encryptor, CryptoStreamMode.Write))
            {
                using (StreamWriter sw = new StreamWriter(cs))
                {
                    sw.Write(text);
                }

                encrypted = ms.ToArray();
            }
        }
    }

    return Convert.ToBase64String(encrypted);
}

 My Apex code:

blob key = blob.valueOf('ABC123DEF456HIJ789KLM012NOP345QR');
blob iv = blob.valueOf('ABC123DEF456HIJ7');
blob encryptedData = blob.valueOf(response.Text);
blob decryptedData = Crypto.decrypt('AES256', key, iv, encryptedData);				
system.debug(decryptedData.toString());

 

Hi, I'm accessing the Salesforce REST API using OAuth. Everything is working, but I noticed that if I change the Callback URL in the Remote Access Application settings, it seems to take a while to refresh. Does anyone know if that setting is cached? Or maybe it just takes a while to save the changes? Thanks for any info.

As shown here in Step Two of the Quick Start section, one should be able to get an access token by simply using the username/password combination.  When I went to a session on the REST API during Dreamforce 2011, this was a valid approach.  Now, we have to append the user's security token to the password.  Is it possible to avoid using the security token, or has Salesforce changed this for good?

 

UPDATE:

From the Digging Deeper into Oauth 2.0 page, found out that the security token is necessary unless "the client's IP address has been whitelisted in your org".  Adding a new trusted IP address range can be done via Setup -> Administration Setup -> Security Controls -> Network Access.

Using this guide as a reference, I've created a Remote Access application entry in my developer account.

I'd like to play around with the Authorization screen that the user should see after navigating to this URL:

 

https://login.salesforce.com/services/oauth2/authorize?response_type=code&client_id=<your_client_id>&redirect_uri=<your_redirect_uri>

 

When I fill in the right values and navigate to the URL, I am not taken to the screen that I expect to see here, but rather the regular Salesforce login screen.  What am I getting wrong?  Thanks.

I have a method that I need to unit test which retrieves a Static Resource object based on the name of the file passed to the method.  In the unit test, I'd like to insert a new Static Resource, like so:

 

Blob b = Blob.valueOf('file contents here');       
StaticResource resource = new StaticResource(Body=b,Name='testFileName');       
insert resource;

// call method to test with newly created Static Resource
string result = methodToTest('testFileName');

 

 However, it fails when trying to insert the static resource.  How else can I insert it?  Thanks.

I need to embed a VF page into the Home page tab.  So far I have made a HTML area component under Home Page Components.  Within the component, I use this to iframe in the VF page:

 

<iframe src="/apex/My_VF_Page"></iframe>

 

However, the result shows the entire page, not just the VF page:

 

 

So the question is, how do I just display the VF page's content?