为什么我在post ajax调用中得到空值?

时间:2015-05-04 13:05:35

标签: asp.net-ajax

这是我的Javascript块:

<dependencies>
    <dependency>
        <groupId>org.bouncycastle</groupId>
        <artifactId>bcprov-jdk15on</artifactId>
        <version>1.52</version>
    </dependency>
    <dependency>
        <groupId>org.bouncycastle</groupId>
        <artifactId>bcpkix-jdk15on</artifactId>
        <version>1.52</version>
    </dependency>
</dependencies>

在邮件调用之后的服务器端,我尝试以这种方式检索值:

package com.nguyen.eledra;

import java.io.FileReader;
import java.security.PrivateKey;
import java.security.Security;

import org.bouncycastle.asn1.pkcs.PrivateKeyInfo;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.openssl.PEMKeyPair;
import org.bouncycastle.openssl.PEMParser;
import org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter;

public class Main {

    private static final String PEM_FILE = "/home/xxxxx/mykey.pem";

    public static void main(String[] args) {

        Security.addProvider(new BouncyCastleProvider());

        FileReader fileReader;
        try {
            fileReader = new FileReader(PEM_FILE);
            PEMParser parser = new PEMParser(fileReader);
            PEMKeyPair kp = (PEMKeyPair) parser.readObject();
            PrivateKeyInfo info = kp.getPrivateKeyInfo();

            PrivateKey rdKey = new JcaPEMKeyConverter().setProvider("BC")
                    .getPrivateKey(info);
            System.out.println(rdKey);
            parser.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
}

但两个值均为空。

我在这里缺少什么? 提前谢谢!

1 个答案:

答案 0 :(得分:0)

使用这两个解决方案,您可能会得到答案:

Solution 1

Solution 2