Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
P

Paresh1462

@Paresh1462
About
Posts
3
Topics
3
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Import Google contacts using Authsub(Secure connection)
    P Paresh1462

    Hello friends, I am learning google API I want to retrieve google contacts using Authsub. And second thing is that i want to use secure token. I have X.509 certificate with private key. In first step I got token but in second step (To get AuthSubSessionToken) I got error : Invalid AuthSub token. Here my code. please, anybody have idea ? Help me....

    $url = "https://www.google.com/accounts/AuthSubSessionToken";
    $token = $token;
    $param['sigalg'] = "rsa-sha1";
    $nonce = "15948".time()."49418"; // any random no(20 digit)
    $param['data'] = "GET https://www.google.com/accounts/AuthSubSessionToken ".time()." ".$nonce;
    $private_key = "MY_PRIVATE_KEY";

    $kvpairs = array();
    foreach ($param as $k => $v) {
    array_push($kvpairs, ($k . '=' . $v));
    }
    $query_string = '';
    $query_string = implode('&', $kvpairs);
    $base_string = 'GET'.'&'.$url .'&'.$query_string;
    $param['sig'] = base64_encode(hash_hmac('sha1', $base_string, $private_key, true));
    uksort($param, 'strcmp');
    $header = 'Authorization: AuthSub token="'.$token.'" ';
    foreach ($param as $k => $v)
    {
    $header .= $k . '="' .$v. '" ';
    }

        $header = trim($header," ");
    $headers\[\]= $header;
    $ch = curl\_init();
    curl\_setopt($ch, CURLOPT\_URL,$url);
    curl\_setopt($ch, CURLOPT\_RETURNTRANSFER, true);
    curl\_setopt($ch, CURLOPT\_SSL\_VERIFYPEER, false);
    curl\_setopt($ch, CURLOPT\_HTTPHEADER, $headers);
    $responce = curl\_exec($ch);
    curl\_close($ch);
    
    Linux, Apache, MySQL, PHP cryptography help database com data-structures

  • signature_invalid in Google API
    P Paresh1462

    I am developing Google app (with oauth 1.0)that retrieve google contatcs but i got error : signature_invalid please help me Thx in advance

    function GetRequestToken()
    {
    $consumer = 'YOUR_CONSUMER_KEY';
    $secret = 'YOUR_CONSUMER_SECRETE';
    $callback = 'http://localhost/Gcontacts/welcome/redirection';
    $sign_method = 'HMAC-SHA1';
    $version = '1.0';
    $scope = 'https://www.google.com/m8/feeds/';
    $path = "/accounts/OAuthGetRequestToken";
    $mt = microtime();
    $rand = mt_rand();
    $nonce = md5($mt.$rand);
    $time = time();
    $url = 'https://www.google.com/accounts/OAuthGetRequestToken';
    $post = array(
    'oauth_callback' => $callback,
    'oauth_consumer_key' => $consumer,
    'oauth_nonce' => $nonce,
    'oauth_signature_method' => $sign_method,
    'oauth_timestamp' => $time,
    'oauth_version' => $version,
    'scope' => $scope
    );
    $post_string1 = '';
    foreach($post as $key => $value)
    {
    $post_string1 .= $key.'='.($value).'&';
    }
    $post_string1 = trim($post_string1, '&');

    $key\_part = $this->urlencodeRFC3986($secret);
    $key = $key\_part;
    $base\_string = $this->calculateBaseString($scope, "GET", $post);
    echo $base\_string;
    $signature = base64\_encode(hash\_hmac('sha1', $base\_string, $key,true));
    $post\_string1 .= 'oauth\_signature'.'='.urlencode($signature);
    		$post\['oauth\_signature'\] = $signature;
    
    $header\[\] = 'POST'.$path.'?scope='.$scope.' HTTP/1.1';
    $header\[\] = 'Content-Type: application/x-www-form-urlencoded';
    $header\[\] = 'Accept: \*/\*';	
    $header\[\] = $this->calculateHeader($post).', Content-Type: application/x-www-form-urlencoded ,Host: www.google.com';			
    $ch = curl\_init();		
    curl\_setopt($ch, CURLOPT\_POSTFIELDS, $post\_string1);
    curl\_setopt($ch, CURLOPT\_HTTPHEADER, $header);
    curl\_setopt($ch, CURLOPT\_URL, $url);
    curl\_setopt($ch, CURLOPT\_POSTFIELDS, 'scope='.$scope);
    curl\_setopt($ch, CURLOPT\_SSL\_VERIFYPEER,false);
    curl\_setopt($ch, CURLOPT\_POST,1);
    curl\_setopt($ch, CURLOPT\_RETURNTRANSFER, true);
    curl\_setopt($ch, CURLOPT\_FOLLOWLOCATION, true);
    $result = curl\_exec($ch);
    curl\_close($ch);
    

    }

    private static function urlencode_rfc3986($value)
    {
    if(is_array($value)) return array_map(array('Welcome_model', 'urlencode_rfc3986'), $value);
    else
    {
    $search = array('+', ' ', '%7E', '%');
    $replace = array('%20', '%20', '~', '%25');

    		return str\_replace($search, $replace, urlencode($value));
    	}
    }
    

    function calculateBaseString($url, $method, array $parameters)
    {
    $url = (string) $url;

    Linux, Apache, MySQL, PHP help com data-structures cryptography json

  • Invalid column
    P Paresh1462

    i got error : Invalid column name 'A1009'.

            chk1 = "select Sno from Student where SID = "+ @smemno.Text.ToString();
            
            SqlCommand ck1 = new SqlCommand(chk1, cn);
            
            v11 = (string)ck1.ExecuteScalar();
    

    what should i do?

    ASP.NET help question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups