Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/mongodb/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Visa代币服务(VTS)_Java - Fatal编程技术网

Java Visa代币服务(VTS)

Java Visa代币服务(VTS),java,Java,是否有任何机构向Visa代币服务发送了具有有效加密的请求 能够通过XPAY令牌生成,请在代码中帮助JWE: public static String generateJWE3(PlainPan pan) throws Exception { Gson gson = new Gson(); String json = gson.toJson(pan); String sharedSecret = Constants.VTS_SHARED_SECRET; Mess

是否有任何机构向Visa代币服务发送了具有有效加密的请求

能够通过XPAY令牌生成,请在代码中帮助JWE:

public static String generateJWE3(PlainPan pan) throws Exception {
    Gson gson = new Gson();
    String json = gson.toJson(pan);

    String sharedSecret = Constants.VTS_SHARED_SECRET;
    MessageDigest md = MessageDigest.getInstance("SHA-256");
    byte[] digest = md.digest(sharedSecret.getBytes("UTF-8"));

    String kid = "gUkXp2s5v8y/A?D(G+KbPeShVmYq3t6w";

    KeyGenerator kg = KeyGenerator.getInstance("AES");
    kg.init(256);

    String encryptionKey = Constants.VTS_API_KEY;

    JWEAlgorithm jweAlgorithm = JWEAlgorithm.A256GCMKW;
    EncryptionMethod encryptionMethod = EncryptionMethod.A256GCM;

    JWEHeader.Builder headerBuilder = new JWEHeader.Builder(jweAlgorithm, encryptionMethod);

    headerBuilder.keyID(encryptionKey);

    JWEHeader header = headerBuilder.build();
    JWEEncrypter encrypter = new AESEncrypter(digest);

    encrypter.getJCAContext().setProvider(BouncyCastleProviderSingleton.getInstance());
    JWEObject jweObject = new JWEObject(header, new Payload(json));
    jweObject.encrypt(encrypter);

    String serialized = jweObject.serialize();
    JWEObject temp = JWEObject.parse(serialized);

    System.out.println("In JWE Header= " + temp.getHeader());
    System.out.println("In Enc Key= " + temp.getEncryptedKey());
    System.out.println("In IV= " + temp.getIV());
    System.out.println("In CT= " + temp.getCipherText());
    System.out.println("In AT= " + temp.getAuthTag());

    //  decrypt(sharedSecret,serialized);

    return serialized;
}


问题是由于无效的
encPaymentInstrument
数据造成的。请要求用户按照以下步骤操作

进行API调用的步骤:

  • 创建VTS应用程序

  • 转到注册的gmail查看VTS发送的电子邮件

  • 导航到该URL()设置密码并创建配置文件,APPID字段的值将为“clientAppID”

  • 请使用
    nimbus-jose-jwt-4.12.jar
    实用程序生成jwe加密

{
  "errorResponse":{
    "status":400,
    "message":"Input for encPaymentInstrument is invalid or inconsistent with the profile.",
    "reason":"invalidParameter",
    "details":[{
      "location":"encPaymentInstrument"
    }]
  }
}