I am trying to integrate my flutter app with a payment api (called iyzico). Following the steps with http plugin and cyrpto plugin doesn't produce the desired solution. I wanted to ask you where is my mistake. I can not obtain the encodedstring property as desired. There is a php code to understand it well. First we need to hash a string with following steps.
Example on php: $string = “some string”;
then we need to hash string with SHA1 (result should be in a raw binary format)
Example on php: $hashedString= sha1($string, true);
My solution like this up to now;
var string = utf8.encode("somestring");
var hashedstring = sha1.convert(string);
Last step is that encode the hashed string to BASE64 format;
Example on php: $encodedString = base_64_encode($hashedString);
My solution was;
Codec<String, String> stringToBase64 = utf8.fuse(base64);
String encodedString = stringToBase64.encode(hashedstring.toString());
I don't know cryptology and crypto plugin very well and I think that ı could not get the value proper format. Thanks for now
This is how I generated the code challenge for PKCE.
import 'dart:convert';
import 'package:crypto/crypto.dart';
String encryptString(String value) =>
base64UrlEncode(utf8.encode(sha256.convert(utf8.encode(value)).toString()));
Hope this may give some insights.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.