Java Code Examples for org.fisco.bcos.web3j.crypto.Sign.SignatureData#getR()

The following examples show how to use org.fisco.bcos.web3j.crypto.Sign.SignatureData#getR() . 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: CommonUtils.java    From WeBASE-Front with Apache License 2.0 6 votes vote down vote up
/**
 * signatureDataToString. 19/12/24 support guomi: add byte[] pub in signatureData
 * 
 * @param signatureData signatureData
 */
public static String signatureDataToString(SignatureData signatureData) {
    byte[] byteArr;
    if (EncryptType.encryptType == 1) {
        byteArr = new byte[1 + signatureData.getR().length + signatureData.getS().length
                + PUBLIC_KEY_LENGTH_64];
        byteArr[0] = signatureData.getV();
        System.arraycopy(signatureData.getR(), 0, byteArr, 1, signatureData.getR().length);
        System.arraycopy(signatureData.getS(), 0, byteArr, signatureData.getR().length + 1,
                signatureData.getS().length);
        System.arraycopy(signatureData.getPub(), 0, byteArr,
                signatureData.getS().length + signatureData.getR().length + 1,
                signatureData.getPub().length);
    } else {
        byteArr = new byte[1 + signatureData.getR().length + signatureData.getS().length];
        byteArr[0] = signatureData.getV();
        System.arraycopy(signatureData.getR(), 0, byteArr, 1, signatureData.getR().length);
        System.arraycopy(signatureData.getS(), 0, byteArr, signatureData.getR().length + 1,
                signatureData.getS().length);
    }
    return Numeric.toHexString(byteArr, 0, byteArr.length, false);
}
 
Example 2
Source File: CommonUtils.java    From WeBASE-Transaction with Apache License 2.0 6 votes vote down vote up
/**
 * signatureDataToString.
 * 19/12/24 support guomi: add byte[] pub in signatureData
 * @param signatureData signatureData
 */
public static String signatureDataToString(SignatureData signatureData) {
    byte[] byteArr;
    if(EncryptType.encryptType == 1) {
        byteArr = new byte[1 + signatureData.getR().length + signatureData.getS().length + publicKeyLength_64];
        byteArr[0] = signatureData.getV();
        System.arraycopy(signatureData.getR(), 0, byteArr, 1, signatureData.getR().length);
        System.arraycopy(signatureData.getS(), 0, byteArr, signatureData.getR().length + 1,
                signatureData.getS().length);
        System.arraycopy(signatureData.getPub(), 0, byteArr,
                signatureData.getS().length + signatureData.getR().length + 1,
                signatureData.getPub().length);
    } else {
        byteArr = new byte[1 + signatureData.getR().length + signatureData.getS().length];
        byteArr[0] = signatureData.getV();
        System.arraycopy(signatureData.getR(), 0, byteArr, 1, signatureData.getR().length);
        System.arraycopy(signatureData.getS(), 0, byteArr, signatureData.getR().length + 1,
                signatureData.getS().length);
    }
    return Numeric.toHexString(byteArr, 0, byteArr.length, false);
}
 
Example 3
Source File: CommonUtils.java    From WeBASE-Sign with Apache License 2.0 5 votes vote down vote up
private static byte[] sigData2ByteArrGuomi(SignatureData signatureData) {
    byte[] targetByteArr;
    targetByteArr = new byte[1 + signatureData.getR().length + signatureData.getS().length + publicKeyLength_64];
    targetByteArr[0] = signatureData.getV();
    System.arraycopy(signatureData.getR(), 0, targetByteArr, 1, signatureData.getR().length);
    System.arraycopy(signatureData.getS(), 0, targetByteArr, signatureData.getR().length + 1,
            signatureData.getS().length);
    System.arraycopy(signatureData.getPub(), 0, targetByteArr,
            signatureData.getS().length + signatureData.getR().length + 1,
            signatureData.getPub().length);
    return targetByteArr;
}
 
Example 4
Source File: CommonUtils.java    From WeBASE-Sign with Apache License 2.0 5 votes vote down vote up
private static byte[] sigData2ByteArrECDSA(SignatureData signatureData) {
    byte[] targetByteArr;
    targetByteArr = new byte[1 + signatureData.getR().length + signatureData.getS().length];
    targetByteArr[0] = signatureData.getV();
    System.arraycopy(signatureData.getR(), 0, targetByteArr, 1, signatureData.getR().length);
    System.arraycopy(signatureData.getS(), 0, targetByteArr, signatureData.getR().length + 1,
            signatureData.getS().length);
    return targetByteArr;
}