Java Code Examples for com.sun.org.apache.xerces.internal.impl.dv.util.HexBin#encode()

The following examples show how to use com.sun.org.apache.xerces.internal.impl.dv.util.HexBin#encode() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GenerateKeyImpl.java    From julongchain with Apache License 2.0 5 votes vote down vote up
public static void writefile(byte[] raw, String path) throws CspException{
    try {
        String keyencode= HexBin.encode(raw);
        File file=new File(path);
        OutputStream outputStream=new FileOutputStream(file);
        outputStream.write(keyencode.getBytes());
        outputStream.close();
        System.out.println(keyencode+" -----> key保存成功");
    } catch (Exception e) {
        // TODO: handle exception
        e.printStackTrace();
        throw new CspException("[JC_PKCS_SOFT]:Writefile failed! ErrMessage: %s\", e.getMessage()");
    }
}
 
Example 2
Source File: Sign.java    From blockchain with Apache License 2.0 5 votes vote down vote up
public static String sign(PrivateKey privateKey, String data) throws Exception {

		PKCS8EncodedKeySpec pkcs8EncodedKeySpec = new PKCS8EncodedKeySpec(privateKey.getEncoded());
		Security.addProvider(new BouncyCastleProvider());
		KeyFactory keyFactory = KeyFactory.getInstance(CryptoConstants.KEY_GEN_ALGORITHM, BouncyCastleProvider.PROVIDER_NAME);
		PrivateKey pkcs8PrivateKey = keyFactory.generatePrivate(pkcs8EncodedKeySpec);
		Signature signature = Signature.getInstance(CryptoConstants.SIGN_ALGORITHM, BouncyCastleProvider.PROVIDER_NAME);
		signature.initSign(pkcs8PrivateKey);
		signature.update(data.getBytes());
		byte[] res = signature.sign();
		return HexBin.encode(res);
	}
 
Example 3
Source File: HexBinaryDV.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
public synchronized String toString() {
    if (canonical == null) {
        canonical = HexBin.encode(data);
    }
    return canonical;
}
 
Example 4
Source File: HexBinaryDV.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public synchronized String toString() {
    if (canonical == null) {
        canonical = HexBin.encode(data);
    }
    return canonical;
}
 
Example 5
Source File: HexBinaryDV.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public synchronized String toString() {
    if (canonical == null) {
        canonical = HexBin.encode(data);
    }
    return canonical;
}
 
Example 6
Source File: HexBinaryDV.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
public synchronized String toString() {
    if (canonical == null) {
        canonical = HexBin.encode(data);
    }
    return canonical;
}
 
Example 7
Source File: HexBinaryDV.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public synchronized String toString() {
    if (canonical == null) {
        canonical = HexBin.encode(data);
    }
    return canonical;
}
 
Example 8
Source File: HexBinaryDV.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public synchronized String toString() {
    if (canonical == null) {
        canonical = HexBin.encode(data);
    }
    return canonical;
}
 
Example 9
Source File: HexBinaryDV.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
public synchronized String toString() {
    if (canonical == null) {
        canonical = HexBin.encode(data);
    }
    return canonical;
}
 
Example 10
Source File: HexBinaryDV.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public synchronized String toString() {
    if (canonical == null) {
        canonical = HexBin.encode(data);
    }
    return canonical;
}
 
Example 11
Source File: HexBinaryDV.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public synchronized String toString() {
    if (canonical == null) {
        canonical = HexBin.encode(data);
    }
    return canonical;
}
 
Example 12
Source File: HexBinaryDV.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public synchronized String toString() {
    if (canonical == null) {
        canonical = HexBin.encode(data);
    }
    return canonical;
}
 
Example 13
Source File: HexBinaryDV.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public synchronized String toString() {
    if (canonical == null) {
        canonical = HexBin.encode(data);
    }
    return canonical;
}