Git Product home page Git Product logo

nos-java-sdk's People

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

nos-java-sdk's Issues

API 27 error

java.lang.NoSuchMethodError: No virtual method setDefaultMaxPerRoute(I)V in class Lorg/apache/http/impl/conn/tsccm/ThreadSafeClientConnManager; or its super classes (declaration of 'org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager' appears in /system/framework/org.apache.http.legacy.boot.jar)
at com.netease.cloud.http.ConnectionManagerFactory.createThreadSafeClientConnManager(ConnectionManagerFactory.java:13)
at com.netease.cloud.http.HttpClientFactory.createHttpClient(HttpClientFactory.java:54)
at com.netease.cloud.http.NeteaseHttpClient.(NeteaseHttpClient.java:80)
at com.netease.cloud.WebServiceClient.(WebServiceClient.java:42)
at com.netease.cloud.services.nos.NosClient.(NosClient.java:190)

Java版本的HmacSHA256实现?

能否给出HmacSHA256的实现,使用JDK自带的HmacSHA256实现,无法与文档中对应。

JSONObject jsonObject = new JSONObject();
    jsonObject.put("Bucket", "doc");
    jsonObject.put("Object", "anne.jpg");
    jsonObject.put("Expires", 1451491200);
    String encodedPutPolicy = new BASE64Encoder().encode(jsonObject.toJSONString().getBytes());
    System.out.println("encodedPutPolicy:" + encodedPutPolicy);
    SecretKeySpec signingKey = new SecretKeySpec("ae0208eea57c4bc9bc5754368c06a542".getBytes(), "HmacSHA256");
    Mac mac = Mac.getInstance(signingKey.getAlgorithm());
    mac.init(signingKey);
    byte[] digest = mac.doFinal(encodedPutPolicy.getBytes("UTF-8"));
    String sign = new String(new Hex().encode(digest));
    String encodedSign = new BASE64Encoder().encode(sign.getBytes());
    System.out.println("encodedSign:" + encodedSign);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.