[twitter-dev] Re: OAuth singing on BlackBerry

2010-08-07 Thread BBTweet Media Player
BB is J2ME but has some quirks that did not allow me to use the
library I tired.  I am just handling the twitter communication on my
own.

On Aug 7, 1:01 am, Bess bess...@gmail.com wrote:
 You need Twitter to approve before you can use xAuth. xAuth is
 different than OAuth.

 Can I ask which xAuth library did you use on BB? Is that Java? not
 J2ME

 On Aug 6, 1:03 pm, BBTweet Media Player bbtweetme...@gmail.com
 wrote:

  WHOOO! I got my first 200 getting an XAuth request token.

  I think the answer to my question is no, I am not expected to get the
  same signature the have in the XAuth example but it always the same on
  my device.  My final problem was I was not URL encoding the signature
  before placing it into the Authorization header.

  Thanks for all the help here hoping to things moving forward quicker.
  I spent way to long trying to figure that out.

  On Aug 6, 2:34 pm, BBTweet Media Player bbtweetme...@gmail.com
  wrote:

   Tom,

   Thanks for the reply.  That is what I tried to do here.  I used the
   exact same values presented on the XAuth 
   pagehttp://dev.twitter.com/pages/xauth.
   Everything was exactly the same upto the point where I ran the HMAC-
   SHA1 encoding

   String signature = hmacsha1(signingSecret, baseString);

   The signature was not the same as the signature the showed in the
   example.  My first question is should it be if I run SHA1 encoding
   will with the same input should it always return the exact same string
   (I just do not know much about the encoding)?  If it should be the
   exact same this means that my problem is definitively in the encoding
   step.  If so can anyone see what I might be doing wrong in the signing
   step...

           HMACKey k = new HMACKey(key.getBytes());
           HMAC hmac = new HMAC(k, new SHA1Digest());
           hmac.update(message.getBytes());
           byte[] mac = hmac.getMAC();
           return Base64OutputStream.encodeAsString(mac, 0, mac.length,
   false, false);

   Thanks,
   Kevin

   On Aug 6, 10:31 am, Tom allerleiga...@gmail.com wrote:

Hi,

I don't have a java compiler ready so I can't test your code.

The page about xAuth shows all steps between the start and the actual
signature. Try reproducing every single one of these values. (Usually
you can simply log all steps and then compare the results with the
xauth page.)

Tom

On Aug 6, 2:56 am, BBTweet Media Player bbtweetme...@gmail.com
wrote:

 I am having a really tough time trying to figure out how to sign my
 OAuth request.  I am trying to follow the example 
 athttp://dev.twitter.com/pages/xauth
 and my signature does not come out the same as it does in the
 example...

 I am doing

 public static void xauth(){
         try {
             String twitter_url=https://api.twitter.com/oauth/
 access_token;
             String oauth_consumer_key = sGNxxnqgZRHUt6NunK3uw;
             String oauth_consumer_secret =
 5kEQypKe7lFHnufLtsocB1vAzO07xLFgp2Pc4sp2vk;
             String oauth_nonce =
 WLxsobj4rhS2xmCbaAeT4aAkRfx4vSHX4OnYpTE77hA;
             String oauth_signature_method = HMAC-SHA1;
             String oauth_timestamp = 1276101652;
             String oauth_version = 1.0;
             String x_auth_mode = client_auth;
             String x_auth_password = %123!aZ+()456242134;
             String x_auth_username = tpFriendlyGiant;

             String postBody = x_auth_mode=+x_auth_mode
 +x_auth_password=+encodeUTF8(x_auth_password)+
                 x_auth_username=+encodeUTF8(x_auth_username);

             String baseString = POST+encodeUTF8(twitter_url)+
                 oauth_consumer_key%3D+oauth_consumer_key +
                 %26oauth_nonce%3D+oauth_nonce+
                 %26oauth_signature_method%3D+oauth_signature_method+
                 %26oauth_timestamp%3D+oauth_timestamp+
                 %26oauth_version%3D+oauth_version+
                 %26+encodeUTF8(postBody);

             String signingSecret = encodeUTF8(oauth_consumer_secret)
 +;

             String signature = hmacsha1(signingSecret, baseString);

             String header = new StringBuffer(OAuth oauth_nonce=
 \).append(oauth_nonce).append(\, oauth_signature_method=\)
                 .append(oauth_signature_method).append(\,
 oauth_timestamp=\).append(oauth_timestamp).append(\,
 oauth_consumer_key=\)
                 .append(oauth_consumer_key).append(\,
 oauth_signature=\).append(signature).append(\, oauth_version=\)
                 .append(oauth_version).append(\).toString();

             System.out.println(Header =  + header);
         } catch (CryptoTokenException e) {
             // TODO Auto-generated catch block
             e.printStackTrace();
         } catch (CryptoUnsupportedOperationException e) {
             // TODO

[twitter-dev] Re: BlackBerry, XAuth and twitterapime

2010-08-07 Thread BBTweet Media Player
Yeah it may be possible to use a javascript library in you to a
BlackBerry WebApp (not sure I did not really look into it).  My app
was written in java and I had already been doing all the twitter
communication on my own.  I was just having trouble transitioning off
BASIC which Twitter is shutting off soon.

On Aug 7, 1:06 am, Bess bess...@gmail.com wrote:
 If Twitter4J do not run on BB, which OAuth or xAuth lib do you use in
 BB?

 There is no other Java option in BB? You have to use J2ME in BB?

 What about webos BB has announced?

 Can I port my Java code from Android straight to BB? How much code re
 factoring or rewrite I have to do to move from Android to BB?

 On Aug 6, 10:23 am, Ernandes Jr. ernan...@gmail.com wrote:

  BB is powered by Java ME and some specific RIM Java APIs.

  On Fri, Aug 6, 2010 at 8:26 AM, David Francisco Tavárez 

  davidftava...@gmail.com wrote:
   Twitter4J do not run on BB.

   2010/8/6, Bess bess...@gmail.com:
I am able to use Twitter4J Oauth in Android SDK 2.1. Can you do the
same on BB?

Does BB has the same JAVA environment similar to Android? I assume
J2SE is very different than Android Java?

On Aug 5, 4:52 pm, BBTweet Media Player bbtweetme...@gmail.com
wrote:
Ernandes,

Thanks for the response.  I am sure there is something small I am
doing wrong.  I did grab twitter4j and made a simple j2se app to make
sure I could use my consumer key and secret and XAuth worked.  So I
know my account is good at least.  I am now trying to hand code the
example onhttp://dev.twitter.com/pages/xauthtomakesure I can
properly encode a header. Everything worked fine using BASIC.  I do
not see why they had to make it so hard.

I am using the BB 5 and 6 OSs.

On Aug 5, 2:39 pm, Ernandes Jr. ernan...@gmail.com wrote:

 I do not have a BB to test the API. However, I have received some
 e-mails
 from people facing same problem as you. Some of them were making some
 small
 mistakes and then it worked, however, others did not have much
   success.
 At
 this moment, I am trying to find the route cause of many problems 
 with
 BB. I
 hope to find it soon and then release a fix for release 1.4.

 By the way. which is your BB's OS version?

 Regards,
 Ernandes

 On Thu, Aug 5, 2010 at 4:56 AM, Bess bess...@gmail.com wrote:
  Which OAuth library did you use on your BB? Did you use the Java
  library?

  On Aug 4, 7:42 am, Ernandes Jr. ernan...@gmail.com wrote:
   Hi,

   I suggest you to get in touch to Twitter API ME support before
   replacing
   codes. Send an e-mail to supp...@twapime.com or check project's
   forum
  page:http://kenai.com/projects/twitterapime/forums/forum

   Maybe your issues are already discussed there.

   Regards,
   Ernandes

   On Tue, Aug 3, 2010 at 9:21 PM, BBTweet Media Player 
  bbtweetme...@gmail.com

wrote:
I am having a very difficult time trying to get XAuth working 
in
my
BlackBerry app.  I have downloaded twitterapime the hmacsha
ecodingand
Base64Ecoder did not seem to work for me so I replaced the
getSignature method in XAuthSigner with...

/**
        * p
        * Generate a signature from the given base string.
        * /p
        * @param baseString Base string.
        * @param consumerSecret Consumer secret.
        * @param tokenSecret Token secret.
        * @return Signature.
        */
       private static String getSignature(String baseString,
String
consumerSecret,
               String tokenSecret) {
//              byte[] b = HMAC.getHmac(baseString,
   consumerSecret
+
  '' +
tokenSecret);
//              //
//              return Base64Encoder.encode(b);
               String ret = null;
               try {
                       ret = hmacsha1(baseString, 
consumerSecret
   +
''
  +
tokenSecret);
               } catch (Exception e) {
                       new RuntimeException(e.getMessage());
               }
               return ret;
       }

       private static String hmacsha1(String key, String
   message)
       throws CryptoTokenException,
  CryptoUnsupportedOperationException,
IOException {
             HMACKey k = new HMACKey(key.getBytes());
             HMAC hmac = new HMAC(k, new SHA1Digest());
             hmac.update(message.getBytes());
             byte[] mac = hmac.getMAC();
             return Base64OutputStream.encodeAsString(mac, 0,
mac.length, false, false);
   }

and any  base 64 encodings with
Base64OutputStream.encodeAsString(mac,
0

[twitter-dev] Re: OAuth singing on BlackBerry

2010-08-06 Thread BBTweet Media Player
Tom,

Thanks for the reply.  That is what I tried to do here.  I used the
exact same values presented on the XAuth page 
http://dev.twitter.com/pages/xauth.
Everything was exactly the same upto the point where I ran the HMAC-
SHA1 encoding

String signature = hmacsha1(signingSecret, baseString);

The signature was not the same as the signature the showed in the
example.  My first question is should it be if I run SHA1 encoding
will with the same input should it always return the exact same string
(I just do not know much about the encoding)?  If it should be the
exact same this means that my problem is definitively in the encoding
step.  If so can anyone see what I might be doing wrong in the signing
step...

HMACKey k = new HMACKey(key.getBytes());
HMAC hmac = new HMAC(k, new SHA1Digest());
hmac.update(message.getBytes());
byte[] mac = hmac.getMAC();
return Base64OutputStream.encodeAsString(mac, 0, mac.length,
false, false);

Thanks,
Kevin

On Aug 6, 10:31 am, Tom allerleiga...@gmail.com wrote:
 Hi,

 I don't have a java compiler ready so I can't test your code.

 The page about xAuth shows all steps between the start and the actual
 signature. Try reproducing every single one of these values. (Usually
 you can simply log all steps and then compare the results with the
 xauth page.)

 Tom

 On Aug 6, 2:56 am, BBTweet Media Player bbtweetme...@gmail.com
 wrote:

  I am having a really tough time trying to figure out how to sign my
  OAuth request.  I am trying to follow the example 
  athttp://dev.twitter.com/pages/xauth
  and my signature does not come out the same as it does in the
  example...

  I am doing

  public static void xauth(){
          try {
              String twitter_url=https://api.twitter.com/oauth/
  access_token;
              String oauth_consumer_key = sGNxxnqgZRHUt6NunK3uw;
              String oauth_consumer_secret =
  5kEQypKe7lFHnufLtsocB1vAzO07xLFgp2Pc4sp2vk;
              String oauth_nonce =
  WLxsobj4rhS2xmCbaAeT4aAkRfx4vSHX4OnYpTE77hA;
              String oauth_signature_method = HMAC-SHA1;
              String oauth_timestamp = 1276101652;
              String oauth_version = 1.0;
              String x_auth_mode = client_auth;
              String x_auth_password = %123!aZ+()456242134;
              String x_auth_username = tpFriendlyGiant;

              String postBody = x_auth_mode=+x_auth_mode
  +x_auth_password=+encodeUTF8(x_auth_password)+
                  x_auth_username=+encodeUTF8(x_auth_username);

              String baseString = POST+encodeUTF8(twitter_url)+
                  oauth_consumer_key%3D+oauth_consumer_key +
                  %26oauth_nonce%3D+oauth_nonce+
                  %26oauth_signature_method%3D+oauth_signature_method+
                  %26oauth_timestamp%3D+oauth_timestamp+
                  %26oauth_version%3D+oauth_version+
                  %26+encodeUTF8(postBody);

              String signingSecret = encodeUTF8(oauth_consumer_secret)
  +;

              String signature = hmacsha1(signingSecret, baseString);

              String header = new StringBuffer(OAuth oauth_nonce=
  \).append(oauth_nonce).append(\, oauth_signature_method=\)
                  .append(oauth_signature_method).append(\,
  oauth_timestamp=\).append(oauth_timestamp).append(\,
  oauth_consumer_key=\)
                  .append(oauth_consumer_key).append(\,
  oauth_signature=\).append(signature).append(\, oauth_version=\)
                  .append(oauth_version).append(\).toString();

              System.out.println(Header =  + header);
          } catch (CryptoTokenException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          } catch (CryptoUnsupportedOperationException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          } catch (IOException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
      }

      private static String hmacsha1(String key, String message) throws
  CryptoTokenException,
          CryptoUnsupportedOperationException, IOException {
          HMACKey k = new HMACKey(key.getBytes());
          HMAC hmac = new HMAC(k, new SHA1Digest());
          hmac.update(message.getBytes());
          byte[] mac = hmac.getMAC();
          return Base64OutputStream.encodeAsString(mac, 0, mac.length,
  false, false);
      }

  Everything matches the example, but when they sign they get...

  oauth_signature=yUDBrcMMm6ghqBEKCFKVoJPIacU%3D

  and I get...

  MUYmiobRdoK6s0ZVqo4xQNNO17w=

  Can anyone see anything I am doing wrong?

  Thanks,
  Kevin


[twitter-dev] Re: OAuth singing on BlackBerry

2010-08-06 Thread BBTweet Media Player
WHOOO! I got my first 200 getting an XAuth request token.

I think the answer to my question is no, I am not expected to get the
same signature the have in the XAuth example but it always the same on
my device.  My final problem was I was not URL encoding the signature
before placing it into the Authorization header.

Thanks for all the help here hoping to things moving forward quicker.
I spent way to long trying to figure that out.


On Aug 6, 2:34 pm, BBTweet Media Player bbtweetme...@gmail.com
wrote:
 Tom,

 Thanks for the reply.  That is what I tried to do here.  I used the
 exact same values presented on the XAuth 
 pagehttp://dev.twitter.com/pages/xauth.
 Everything was exactly the same upto the point where I ran the HMAC-
 SHA1 encoding

 String signature = hmacsha1(signingSecret, baseString);

 The signature was not the same as the signature the showed in the
 example.  My first question is should it be if I run SHA1 encoding
 will with the same input should it always return the exact same string
 (I just do not know much about the encoding)?  If it should be the
 exact same this means that my problem is definitively in the encoding
 step.  If so can anyone see what I might be doing wrong in the signing
 step...

         HMACKey k = new HMACKey(key.getBytes());
         HMAC hmac = new HMAC(k, new SHA1Digest());
         hmac.update(message.getBytes());
         byte[] mac = hmac.getMAC();
         return Base64OutputStream.encodeAsString(mac, 0, mac.length,
 false, false);

 Thanks,
 Kevin

 On Aug 6, 10:31 am, Tom allerleiga...@gmail.com wrote:

  Hi,

  I don't have a java compiler ready so I can't test your code.

  The page about xAuth shows all steps between the start and the actual
  signature. Try reproducing every single one of these values. (Usually
  you can simply log all steps and then compare the results with the
  xauth page.)

  Tom

  On Aug 6, 2:56 am, BBTweet Media Player bbtweetme...@gmail.com
  wrote:

   I am having a really tough time trying to figure out how to sign my
   OAuth request.  I am trying to follow the example 
   athttp://dev.twitter.com/pages/xauth
   and my signature does not come out the same as it does in the
   example...

   I am doing

   public static void xauth(){
           try {
               String twitter_url=https://api.twitter.com/oauth/
   access_token;
               String oauth_consumer_key = sGNxxnqgZRHUt6NunK3uw;
               String oauth_consumer_secret =
   5kEQypKe7lFHnufLtsocB1vAzO07xLFgp2Pc4sp2vk;
               String oauth_nonce =
   WLxsobj4rhS2xmCbaAeT4aAkRfx4vSHX4OnYpTE77hA;
               String oauth_signature_method = HMAC-SHA1;
               String oauth_timestamp = 1276101652;
               String oauth_version = 1.0;
               String x_auth_mode = client_auth;
               String x_auth_password = %123!aZ+()456242134;
               String x_auth_username = tpFriendlyGiant;

               String postBody = x_auth_mode=+x_auth_mode
   +x_auth_password=+encodeUTF8(x_auth_password)+
                   x_auth_username=+encodeUTF8(x_auth_username);

               String baseString = POST+encodeUTF8(twitter_url)+
                   oauth_consumer_key%3D+oauth_consumer_key +
                   %26oauth_nonce%3D+oauth_nonce+
                   %26oauth_signature_method%3D+oauth_signature_method+
                   %26oauth_timestamp%3D+oauth_timestamp+
                   %26oauth_version%3D+oauth_version+
                   %26+encodeUTF8(postBody);

               String signingSecret = encodeUTF8(oauth_consumer_secret)
   +;

               String signature = hmacsha1(signingSecret, baseString);

               String header = new StringBuffer(OAuth oauth_nonce=
   \).append(oauth_nonce).append(\, oauth_signature_method=\)
                   .append(oauth_signature_method).append(\,
   oauth_timestamp=\).append(oauth_timestamp).append(\,
   oauth_consumer_key=\)
                   .append(oauth_consumer_key).append(\,
   oauth_signature=\).append(signature).append(\, oauth_version=\)
                   .append(oauth_version).append(\).toString();

               System.out.println(Header =  + header);
           } catch (CryptoTokenException e) {
               // TODO Auto-generated catch block
               e.printStackTrace();
           } catch (CryptoUnsupportedOperationException e) {
               // TODO Auto-generated catch block
               e.printStackTrace();
           } catch (IOException e) {
               // TODO Auto-generated catch block
               e.printStackTrace();
           }
       }

       private static String hmacsha1(String key, String message) throws
   CryptoTokenException,
           CryptoUnsupportedOperationException, IOException {
           HMACKey k = new HMACKey(key.getBytes());
           HMAC hmac = new HMAC(k, new SHA1Digest());
           hmac.update(message.getBytes());
           byte[] mac = hmac.getMAC();
           return

[twitter-dev] Re: BlackBerry, XAuth and twitterapime

2010-08-05 Thread BBTweet Media Player
Ernandes,

Thanks for the response.  I am sure there is something small I am
doing wrong.  I did grab twitter4j and made a simple j2se app to make
sure I could use my consumer key and secret and XAuth worked.  So I
know my account is good at least.  I am now trying to hand code the
example on http://dev.twitter.com/pages/xauth to make sure I can
properly encode a header. Everything worked fine using BASIC.  I do
not see why they had to make it so hard.

I am using the BB 5 and 6 OSs.

On Aug 5, 2:39 pm, Ernandes Jr. ernan...@gmail.com wrote:
 I do not have a BB to test the API. However, I have received some e-mails
 from people facing same problem as you. Some of them were making some small
 mistakes and then it worked, however, others did not have much success. At
 this moment, I am trying to find the route cause of many problems with BB. I
 hope to find it soon and then release a fix for release 1.4.

 By the way. which is your BB's OS version?

 Regards,
 Ernandes



 On Thu, Aug 5, 2010 at 4:56 AM, Bess bess...@gmail.com wrote:
  Which OAuth library did you use on your BB? Did you use the Java
  library?

  On Aug 4, 7:42 am, Ernandes Jr. ernan...@gmail.com wrote:
   Hi,

   I suggest you to get in touch to Twitter API ME support before replacing
   codes. Send an e-mail to supp...@twapime.com or check project's forum
  page:http://kenai.com/projects/twitterapime/forums/forum

   Maybe your issues are already discussed there.

   Regards,
   Ernandes

   On Tue, Aug 3, 2010 at 9:21 PM, BBTweet Media Player 
  bbtweetme...@gmail.com

wrote:
I am having a very difficult time trying to get XAuth working in my
BlackBerry app.  I have downloaded twitterapime the hmacsha ecodingand
Base64Ecoder did not seem to work for me so I replaced the
getSignature method in XAuthSigner with...

/**
        * p
        * Generate a signature from the given base string.
        * /p
        * @param baseString Base string.
        * @param consumerSecret Consumer secret.
        * @param tokenSecret Token secret.
        * @return Signature.
        */
       private static String getSignature(String baseString, String
consumerSecret,
               String tokenSecret) {
//              byte[] b = HMAC.getHmac(baseString, consumerSecret +
  '' +
tokenSecret);
//              //
//              return Base64Encoder.encode(b);
               String ret = null;
               try {
                       ret = hmacsha1(baseString, consumerSecret + ''
  +
tokenSecret);
               } catch (Exception e) {
                       new RuntimeException(e.getMessage());
               }
               return ret;
       }

       private static String hmacsha1(String key, String message)
       throws CryptoTokenException,
  CryptoUnsupportedOperationException,
IOException {
             HMACKey k = new HMACKey(key.getBytes());
             HMAC hmac = new HMAC(k, new SHA1Digest());
             hmac.update(message.getBytes());
             byte[] mac = hmac.getMAC();
             return Base64OutputStream.encodeAsString(mac, 0,
mac.length, false, false);
   }

and any  base 64 encodings with Base64OutputStream.encodeAsString(mac,
0, mac.length, false, false);

I get 401 errors when attempting to get my request token.

I can replace my secrets, ids and pass with dummys and place a step by
steps of what is going on if that would help?

   --
   Ernandes Jr.
   -
   ALL programs are poems. However,
   NOT all programmers are poets.

 --
 Ernandes Jr.
 -
 ALL programs are poems. However,
 NOT all programmers are poets.


[twitter-dev] OAuth singing on BlackBerry

2010-08-05 Thread BBTweet Media Player
I am having a really tough time trying to figure out how to sign my
OAuth request.  I am trying to follow the example at 
http://dev.twitter.com/pages/xauth
and my signature does not come out the same as it does in the
example...

I am doing

public static void xauth(){
try {
String twitter_url=https://api.twitter.com/oauth/
access_token;
String oauth_consumer_key = sGNxxnqgZRHUt6NunK3uw;
String oauth_consumer_secret =
5kEQypKe7lFHnufLtsocB1vAzO07xLFgp2Pc4sp2vk;
String oauth_nonce =
WLxsobj4rhS2xmCbaAeT4aAkRfx4vSHX4OnYpTE77hA;
String oauth_signature_method = HMAC-SHA1;
String oauth_timestamp = 1276101652;
String oauth_version = 1.0;
String x_auth_mode = client_auth;
String x_auth_password = %123!aZ+()456242134;
String x_auth_username = tpFriendlyGiant;

String postBody = x_auth_mode=+x_auth_mode
+x_auth_password=+encodeUTF8(x_auth_password)+
x_auth_username=+encodeUTF8(x_auth_username);

String baseString = POST+encodeUTF8(twitter_url)+
oauth_consumer_key%3D+oauth_consumer_key +
%26oauth_nonce%3D+oauth_nonce+
%26oauth_signature_method%3D+oauth_signature_method+
%26oauth_timestamp%3D+oauth_timestamp+
%26oauth_version%3D+oauth_version+
%26+encodeUTF8(postBody);

String signingSecret = encodeUTF8(oauth_consumer_secret)
+;

String signature = hmacsha1(signingSecret, baseString);

String header = new StringBuffer(OAuth oauth_nonce=
\).append(oauth_nonce).append(\, oauth_signature_method=\)
.append(oauth_signature_method).append(\,
oauth_timestamp=\).append(oauth_timestamp).append(\,
oauth_consumer_key=\)
.append(oauth_consumer_key).append(\,
oauth_signature=\).append(signature).append(\, oauth_version=\)
.append(oauth_version).append(\).toString();

System.out.println(Header =  + header);
} catch (CryptoTokenException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (CryptoUnsupportedOperationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

private static String hmacsha1(String key, String message) throws
CryptoTokenException,
CryptoUnsupportedOperationException, IOException {
HMACKey k = new HMACKey(key.getBytes());
HMAC hmac = new HMAC(k, new SHA1Digest());
hmac.update(message.getBytes());
byte[] mac = hmac.getMAC();
return Base64OutputStream.encodeAsString(mac, 0, mac.length,
false, false);
}

Everything matches the example, but when they sign they get...

oauth_signature=yUDBrcMMm6ghqBEKCFKVoJPIacU%3D

and I get...

MUYmiobRdoK6s0ZVqo4xQNNO17w=

Can anyone see anything I am doing wrong?

Thanks,
Kevin


[twitter-dev] BlackBerry, XAuth and twitterapime

2010-08-03 Thread BBTweet Media Player
I am having a very difficult time trying to get XAuth working in my
BlackBerry app.  I have downloaded twitterapime the hmacsha ecodingand
Base64Ecoder did not seem to work for me so I replaced the
getSignature method in XAuthSigner with...

/**
 * p
 * Generate a signature from the given base string.
 * /p
 * @param baseString Base string.
 * @param consumerSecret Consumer secret.
 * @param tokenSecret Token secret.
 * @return Signature.
 */
private static String getSignature(String baseString, String
consumerSecret,
String tokenSecret) {
//  byte[] b = HMAC.getHmac(baseString, consumerSecret + '' +
tokenSecret);
//  //
//  return Base64Encoder.encode(b);
String ret = null;
try {
ret = hmacsha1(baseString, consumerSecret + '' + 
tokenSecret);
} catch (Exception e) {
new RuntimeException(e.getMessage());
}
return ret;
}


private static String hmacsha1(String key, String message)
throws CryptoTokenException, CryptoUnsupportedOperationException,
IOException {
  HMACKey k = new HMACKey(key.getBytes());
  HMAC hmac = new HMAC(k, new SHA1Digest());
  hmac.update(message.getBytes());
  byte[] mac = hmac.getMAC();
  return Base64OutputStream.encodeAsString(mac, 0,
mac.length, false, false);
}

and any  base 64 encodings with Base64OutputStream.encodeAsString(mac,
0, mac.length, false, false);

I get 401 errors when attempting to get my request token.

I can replace my secrets, ids and pass with dummys and place a step by
steps of what is going on if that would help?