Java Code Examples for sun.security.util.Debug#toHexString()

The following examples show how to use sun.security.util.Debug#toHexString() . 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: SignerInfo.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
public String toString() {
    HexDumpEncoder hexDump = new HexDumpEncoder();

    String out = "";

    out += "Signer Info for (issuer): " + issuerName + "\n";
    out += "\tversion: " + Debug.toHexString(version) + "\n";
    out += "\tcertificateSerialNumber: " +
           Debug.toHexString(certificateSerialNumber) + "\n";
    out += "\tdigestAlgorithmId: " + digestAlgorithmId + "\n";
    if (authenticatedAttributes != null) {
        out += "\tauthenticatedAttributes: " + authenticatedAttributes +
               "\n";
    }
    out += "\tdigestEncryptionAlgorithmId: " + digestEncryptionAlgorithmId +
        "\n";

    out += "\tencryptedDigest: " + "\n" +
        hexDump.encodeBuffer(encryptedDigest) + "\n";
    if (unauthenticatedAttributes != null) {
        out += "\tunauthenticatedAttributes: " +
               unauthenticatedAttributes + "\n";
    }
    return out;
}
 
Example 2
Source File: SignerInfo.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
public String toString() {
    HexDumpEncoder hexDump = new HexDumpEncoder();

    String out = "";

    out += "Signer Info for (issuer): " + issuerName + "\n";
    out += "\tversion: " + Debug.toHexString(version) + "\n";
    out += "\tcertificateSerialNumber: " +
           Debug.toHexString(certificateSerialNumber) + "\n";
    out += "\tdigestAlgorithmId: " + digestAlgorithmId + "\n";
    if (authenticatedAttributes != null) {
        out += "\tauthenticatedAttributes: " + authenticatedAttributes +
               "\n";
    }
    out += "\tdigestEncryptionAlgorithmId: " + digestEncryptionAlgorithmId +
        "\n";

    out += "\tencryptedDigest: " + "\n" +
        hexDump.encodeBuffer(encryptedDigest) + "\n";
    if (unauthenticatedAttributes != null) {
        out += "\tunauthenticatedAttributes: " +
               unauthenticatedAttributes + "\n";
    }
    return out;
}
 
Example 3
Source File: DSA.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return a human readable rendition of the engine.
 */
public String toString() {
    String printable = "DSA Signature";
    if (presetP != null && presetQ != null && presetG != null) {
        printable += "\n\tp: " + Debug.toHexString(presetP);
        printable += "\n\tq: " + Debug.toHexString(presetQ);
        printable += "\n\tg: " + Debug.toHexString(presetG);
    } else {
        printable += "\n\t P, Q or G not initialized.";
    }
    if (presetY != null) {
        printable += "\n\ty: " + Debug.toHexString(presetY);
    }
    if (presetY == null && presetX == null) {
        printable += "\n\tUNINIIALIZED";
    }
    return printable;
}
 
Example 4
Source File: SignerInfo.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public String toString() {
    HexDumpEncoder hexDump = new HexDumpEncoder();

    String out = "";

    out += "Signer Info for (issuer): " + issuerName + "\n";
    out += "\tversion: " + Debug.toHexString(version) + "\n";
    out += "\tcertificateSerialNumber: " +
           Debug.toHexString(certificateSerialNumber) + "\n";
    out += "\tdigestAlgorithmId: " + digestAlgorithmId + "\n";
    if (authenticatedAttributes != null) {
        out += "\tauthenticatedAttributes: " + authenticatedAttributes +
               "\n";
    }
    out += "\tdigestEncryptionAlgorithmId: " + digestEncryptionAlgorithmId +
        "\n";

    out += "\tencryptedDigest: " + "\n" +
        hexDump.encodeBuffer(encryptedDigest) + "\n";
    if (unauthenticatedAttributes != null) {
        out += "\tunauthenticatedAttributes: " +
               unauthenticatedAttributes + "\n";
    }
    return out;
}
 
Example 5
Source File: DSA.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return a human readable rendition of the engine.
 */
public String toString() {
    String printable = "DSA Signature";
    if (presetP != null && presetQ != null && presetG != null) {
        printable += "\n\tp: " + Debug.toHexString(presetP);
        printable += "\n\tq: " + Debug.toHexString(presetQ);
        printable += "\n\tg: " + Debug.toHexString(presetG);
    } else {
        printable += "\n\t P, Q or G not initialized.";
    }
    if (presetY != null) {
        printable += "\n\ty: " + Debug.toHexString(presetY);
    }
    if (presetY == null && presetX == null) {
        printable += "\n\tUNINIIALIZED";
    }
    return printable;
}
 
Example 6
Source File: SignerInfo.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public String toString() {
    HexDumpEncoder hexDump = new HexDumpEncoder();

    String out = "";

    out += "Signer Info for (issuer): " + issuerName + "\n";
    out += "\tversion: " + Debug.toHexString(version) + "\n";
    out += "\tcertificateSerialNumber: " +
           Debug.toHexString(certificateSerialNumber) + "\n";
    out += "\tdigestAlgorithmId: " + digestAlgorithmId + "\n";
    if (authenticatedAttributes != null) {
        out += "\tauthenticatedAttributes: " + authenticatedAttributes +
               "\n";
    }
    out += "\tdigestEncryptionAlgorithmId: " + digestEncryptionAlgorithmId +
        "\n";

    out += "\tencryptedDigest: " + "\n" +
        hexDump.encodeBuffer(encryptedDigest) + "\n";
    if (unauthenticatedAttributes != null) {
        out += "\tunauthenticatedAttributes: " +
               unauthenticatedAttributes + "\n";
    }
    return out;
}
 
Example 7
Source File: DSA.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return a human readable rendition of the engine.
 */
public String toString() {
    String printable = "DSA Signature";
    if (presetP != null && presetQ != null && presetG != null) {
        printable += "\n\tp: " + Debug.toHexString(presetP);
        printable += "\n\tq: " + Debug.toHexString(presetQ);
        printable += "\n\tg: " + Debug.toHexString(presetG);
    } else {
        printable += "\n\t P, Q or G not initialized.";
    }
    if (presetY != null) {
        printable += "\n\ty: " + Debug.toHexString(presetY);
    }
    if (presetY == null && presetX == null) {
        printable += "\n\tUNINIIALIZED";
    }
    return printable;
}
 
Example 8
Source File: DSA.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return a human readable rendition of the engine.
 */
public String toString() {
    String printable = "DSA Signature";
    if (presetP != null && presetQ != null && presetG != null) {
        printable += "\n\tp: " + Debug.toHexString(presetP);
        printable += "\n\tq: " + Debug.toHexString(presetQ);
        printable += "\n\tg: " + Debug.toHexString(presetG);
    } else {
        printable += "\n\t P, Q or G not initialized.";
    }
    if (presetY != null) {
        printable += "\n\ty: " + Debug.toHexString(presetY);
    }
    if (presetY == null && presetX == null) {
        printable += "\n\tUNINIIALIZED";
    }
    return printable;
}
 
Example 9
Source File: DSA.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return a human readable rendition of the engine.
 */
public String toString() {
    String printable = "DSA Signature";
    if (presetP != null && presetQ != null && presetG != null) {
        printable += "\n\tp: " + Debug.toHexString(presetP);
        printable += "\n\tq: " + Debug.toHexString(presetQ);
        printable += "\n\tg: " + Debug.toHexString(presetG);
    } else {
        printable += "\n\t P, Q or G not initialized.";
    }
    if (presetY != null) {
        printable += "\n\ty: " + Debug.toHexString(presetY);
    }
    if (presetY == null && presetX == null) {
        printable += "\n\tUNINIIALIZED";
    }
    return printable;
}
 
Example 10
Source File: DSA.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return a human readable rendition of the engine.
 */
public String toString() {
    String printable = "DSA Signature";
    if (presetP != null && presetQ != null && presetG != null) {
        printable += "\n\tp: " + Debug.toHexString(presetP);
        printable += "\n\tq: " + Debug.toHexString(presetQ);
        printable += "\n\tg: " + Debug.toHexString(presetG);
    } else {
        printable += "\n\t P, Q or G not initialized.";
    }
    if (presetY != null) {
        printable += "\n\ty: " + Debug.toHexString(presetY);
    }
    if (presetY == null && presetX == null) {
        printable += "\n\tUNINIIALIZED";
    }
    return printable;
}
 
Example 11
Source File: CryptoUtil.java    From julongchain with Apache License 2.0 6 votes vote down vote up
/**
 * 读取私钥文件
 * @param skPath
 * @return
 * @throws CspException
 * @throws IOException
 */
public static byte[] readSkFile(String skPath) throws CspException, IOException {
    InputStreamReader reader = new InputStreamReader(new FileInputStream(skPath));
    PemReader pemReader = new PemReader(reader);
    PemObject pemObject = pemReader.readPemObject();
    reader.close();
    byte[] encodedData = pemObject.getContent();
    DerValue derValue = new DerValue(new ByteArrayInputStream(encodedData));
    byte[] rawPrivateKey = null;
    if (derValue.tag != 48) {
        throw new CspException("invalid key format");
    } else {
        BigInteger version = derValue.data.getBigInteger();
        if (!version.equals(BigInteger.ZERO)) {
            throw new CspException("version mismatch: (supported: " + Debug.toHexString(BigInteger.ZERO) + ", parsed: " + Debug.toHexString(version));
        } else {
            AlgorithmId algId = AlgorithmId.parse(derValue.data.getDerValue());
            rawPrivateKey = derValue.data.getOctetString();
        }
        return rawPrivateKey;
    }
}
 
Example 12
Source File: CspHelper.java    From julongchain with Apache License 2.0 6 votes vote down vote up
private static List<Object> decodePrivateKeyPKCS8(byte[] encodedData) throws JulongChainException {
    try {
        DerValue derValue = new DerValue(new ByteArrayInputStream(encodedData));
        if (derValue.tag != ASN1_SEQUENCE) {
            throw new JulongChainException("invalid key format");
        } else {
            BigInteger version = derValue.data.getBigInteger();
            if (!version.equals(BigInteger.ZERO)) {
                throw new JulongChainException("version mismatch: (supported: " + Debug.toHexString(BigInteger.ZERO) + ", parsed: " + Debug.toHexString(version));
            } else {
                AlgorithmId algId = AlgorithmId.parse(derValue.data.getDerValue());
                byte[] rawPrivateKey = derValue.data.getOctetString();
                List<Object> list = new ArrayList<>();
                list.add(algId);
                list.add(rawPrivateKey);
                return list;
            }
        }
    } catch (IOException e) {
        throw new JulongChainException("IOException : " + e.getMessage());
    }
}
 
Example 13
Source File: SignerInfo.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public String toString() {
    HexDumpEncoder hexDump = new HexDumpEncoder();

    String out = "";

    out += "Signer Info for (issuer): " + issuerName + "\n";
    out += "\tversion: " + Debug.toHexString(version) + "\n";
    out += "\tcertificateSerialNumber: " +
           Debug.toHexString(certificateSerialNumber) + "\n";
    out += "\tdigestAlgorithmId: " + digestAlgorithmId + "\n";
    if (authenticatedAttributes != null) {
        out += "\tauthenticatedAttributes: " + authenticatedAttributes +
               "\n";
    }
    out += "\tdigestEncryptionAlgorithmId: " + digestEncryptionAlgorithmId +
        "\n";

    out += "\tencryptedDigest: " + "\n" +
        hexDump.encodeBuffer(encryptedDigest) + "\n";
    if (unauthenticatedAttributes != null) {
        out += "\tunauthenticatedAttributes: " +
               unauthenticatedAttributes + "\n";
    }
    return out;
}
 
Example 14
Source File: DSA.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * Return a human readable rendition of the engine.
 */
public String toString() {
    String printable = "DSA Signature";
    if (presetP != null && presetQ != null && presetG != null) {
        printable += "\n\tp: " + Debug.toHexString(presetP);
        printable += "\n\tq: " + Debug.toHexString(presetQ);
        printable += "\n\tg: " + Debug.toHexString(presetG);
    } else {
        printable += "\n\t P, Q or G not initialized.";
    }
    if (presetY != null) {
        printable += "\n\ty: " + Debug.toHexString(presetY);
    }
    if (presetY == null && presetX == null) {
        printable += "\n\tUNINIIALIZED";
    }
    return printable;
}
 
Example 15
Source File: DSAParameters.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
protected String engineToString() {
    return "\n\tp: " + Debug.toHexString(p)
        + "\n\tq: " + Debug.toHexString(q)
        + "\n\tg: " + Debug.toHexString(g)
        + "\n";
}
 
Example 16
Source File: DSAPublicKey.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public String toString() {
    return "Sun DSA Public Key\n    Parameters:" + algid
        + "\n  y:\n" + Debug.toHexString(y) + "\n";
}
 
Example 17
Source File: DSAParameters.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
protected String engineToString() {
    return "\n\tp: " + Debug.toHexString(p)
        + "\n\tq: " + Debug.toHexString(q)
        + "\n\tg: " + Debug.toHexString(g)
        + "\n";
}
 
Example 18
Source File: DSAPublicKey.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public String toString() {
    return "Sun DSA Public Key\n    Parameters:" + algid
        + "\n  y:\n" + Debug.toHexString(y) + "\n";
}
 
Example 19
Source File: DSAPublicKey.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
public String toString() {
    return "Sun DSA Public Key\n    Parameters:" + algid
        + "\n  y:\n" + Debug.toHexString(y) + "\n";
}
 
Example 20
Source File: DSAPublicKey.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
public String toString() {
    return "Sun DSA Public Key\n    Parameters:" + algid
        + "\n  y:\n" + Debug.toHexString(y) + "\n";
}