Search in sources :

Example 11 with HexDumpEncoder

use of sun.security.util.HexDumpEncoder in project Bytecoder by mirkosertic.

the class X509CRLEntryImpl method toString.

/**
 * Returns a printable string of this revoked certificate.
 *
 * @return value of this revoked certificate in a printable form.
 */
@Override
public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append(serialNumber).append("  On: ").append(revocationDate);
    if (certIssuer != null) {
        sb.append("\n    Certificate issuer: ").append(certIssuer);
    }
    if (extensions != null) {
        Collection<Extension> allEntryExts = extensions.getAllExtensions();
        Extension[] exts = allEntryExts.toArray(new Extension[0]);
        sb.append("\n    CRL Entry Extensions: ").append(exts.length);
        for (int i = 0; i < exts.length; i++) {
            sb.append("\n    [").append(i + 1).append("]: ");
            Extension ext = exts[i];
            try {
                if (OIDMap.getClass(ext.getExtensionId()) == null) {
                    sb.append(ext);
                    byte[] extValue = ext.getExtensionValue();
                    if (extValue != null) {
                        DerOutputStream out = new DerOutputStream();
                        out.putOctetString(extValue);
                        extValue = out.toByteArray();
                        HexDumpEncoder enc = new HexDumpEncoder();
                        sb.append("Extension unknown: ").append("DER encoded OCTET string =\n").append(enc.encodeBuffer(extValue)).append('\n');
                    }
                } else {
                    // sub-class exists
                    sb.append(ext);
                }
            } catch (Exception e) {
                sb.append(", Error parsing this extension");
            }
        }
    }
    sb.append('\n');
    return sb.toString();
}
Also used : HexDumpEncoder(sun.security.util.HexDumpEncoder) IOException(java.io.IOException) CRLException(java.security.cert.CRLException)

Example 12 with HexDumpEncoder

use of sun.security.util.HexDumpEncoder in project Bytecoder by mirkosertic.

the class KeyIdentifier method toString.

/**
 * Returns a printable representation of the KeyUsage.
 */
public String toString() {
    String s = "KeyIdentifier [\n";
    HexDumpEncoder encoder = new HexDumpEncoder();
    s += encoder.encodeBuffer(octetString);
    s += "]\n";
    return (s);
}
Also used : HexDumpEncoder(sun.security.util.HexDumpEncoder)

Example 13 with HexDumpEncoder

use of sun.security.util.HexDumpEncoder in project Bytecoder by mirkosertic.

the class PolicyQualifierInfo method toString.

/**
 * Return a printable representation of this
 * {@code PolicyQualifierInfo}.
 *
 * @return a {@code String} describing the contents of this
 *         {@code PolicyQualifierInfo}
 */
public String toString() {
    if (pqiString != null)
        return pqiString;
    HexDumpEncoder enc = new HexDumpEncoder();
    StringBuilder sb = new StringBuilder();
    sb.append("PolicyQualifierInfo: [\n");
    sb.append("  qualifierID: " + mId + "\n");
    sb.append("  qualifier: " + (mData == null ? "null" : enc.encodeBuffer(mData)) + "\n");
    sb.append("]");
    pqiString = sb.toString();
    return pqiString;
}
Also used : HexDumpEncoder(sun.security.util.HexDumpEncoder)

Example 14 with HexDumpEncoder

use of sun.security.util.HexDumpEncoder in project Bytecoder by mirkosertic.

the class X509CertSelector method toString.

/**
 * Return a printable representation of the {@code CertSelector}.
 *
 * @return a {@code String} describing the contents of the
 *         {@code CertSelector}
 */
public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("X509CertSelector: [\n");
    if (x509Cert != null) {
        sb.append("  Certificate: " + x509Cert.toString() + "\n");
    }
    if (serialNumber != null) {
        sb.append("  Serial Number: " + serialNumber.toString() + "\n");
    }
    if (issuer != null) {
        sb.append("  Issuer: " + getIssuerAsString() + "\n");
    }
    if (subject != null) {
        sb.append("  Subject: " + getSubjectAsString() + "\n");
    }
    sb.append("  matchAllSubjectAltNames flag: " + String.valueOf(matchAllSubjectAltNames) + "\n");
    if (subjectAlternativeNames != null) {
        sb.append("  SubjectAlternativeNames:\n");
        Iterator<List<?>> i = subjectAlternativeNames.iterator();
        while (i.hasNext()) {
            List<?> list = i.next();
            sb.append("    type " + list.get(0) + ", name " + list.get(1) + "\n");
        }
    }
    if (subjectKeyID != null) {
        HexDumpEncoder enc = new HexDumpEncoder();
        sb.append("  Subject Key Identifier: " + enc.encodeBuffer(subjectKeyID) + "\n");
    }
    if (authorityKeyID != null) {
        HexDumpEncoder enc = new HexDumpEncoder();
        sb.append("  Authority Key Identifier: " + enc.encodeBuffer(authorityKeyID) + "\n");
    }
    if (certificateValid != null) {
        sb.append("  Certificate Valid: " + certificateValid.toString() + "\n");
    }
    if (privateKeyValid != null) {
        sb.append("  Private Key Valid: " + privateKeyValid.toString() + "\n");
    }
    if (subjectPublicKeyAlgID != null) {
        sb.append("  Subject Public Key AlgID: " + subjectPublicKeyAlgID.toString() + "\n");
    }
    if (subjectPublicKey != null) {
        sb.append("  Subject Public Key: " + subjectPublicKey.toString() + "\n");
    }
    if (keyUsage != null) {
        sb.append("  Key Usage: " + keyUsageToString(keyUsage) + "\n");
    }
    if (keyPurposeSet != null) {
        sb.append("  Extended Key Usage: " + keyPurposeSet.toString() + "\n");
    }
    if (policy != null) {
        sb.append("  Policy: " + policy.toString() + "\n");
    }
    if (pathToGeneralNames != null) {
        sb.append("  Path to names:\n");
        Iterator<GeneralNameInterface> i = pathToGeneralNames.iterator();
        while (i.hasNext()) {
            sb.append("    " + i.next() + "\n");
        }
    }
    sb.append("]");
    return sb.toString();
}
Also used : HexDumpEncoder(sun.security.util.HexDumpEncoder)

Example 15 with HexDumpEncoder

use of sun.security.util.HexDumpEncoder in project Bytecoder by mirkosertic.

the class BlockCipherParamsCore method toString.

/*
     * Returns a formatted string describing the parameters.
     */
public String toString() {
    String LINE_SEP = System.getProperty("line.separator");
    String ivString = LINE_SEP + "    iv:" + LINE_SEP + "[";
    HexDumpEncoder encoder = new HexDumpEncoder();
    ivString += encoder.encodeBuffer(this.iv);
    ivString += "]" + LINE_SEP;
    return ivString;
}
Also used : HexDumpEncoder(sun.security.util.HexDumpEncoder)

Aggregations

HexDumpEncoder (sun.security.util.HexDumpEncoder)27 IOException (java.io.IOException)8 ByteArrayInputStream (java.io.ByteArrayInputStream)2 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)2 CRLException (java.security.cert.CRLException)2 PRF (sun.security.ssl.CipherSuite.PRF)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 ByteBuffer (java.nio.ByteBuffer)1 InvalidKeyException (java.security.InvalidKeyException)1 NoSuchProviderException (java.security.NoSuchProviderException)1 SignatureException (java.security.SignatureException)1 CertificateException (java.security.cert.CertificateException)1 Extension (java.security.cert.Extension)1 X509CRLEntry (java.security.cert.X509CRLEntry)1 ArrayList (java.util.ArrayList)1