use of sun.misc.HexDumpEncoder in project jdk8u_jdk by JetBrains.
the class CertId method toString.
/**
* Create a string representation of the CertId.
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("CertId \n");
sb.append("Algorithm: " + hashAlgId.toString() + "\n");
sb.append("issuerNameHash \n");
HexDumpEncoder encoder = new HexDumpEncoder();
sb.append(encoder.encode(issuerNameHash));
sb.append("\nissuerKeyHash: \n");
sb.append(encoder.encode(issuerKeyHash));
sb.append("\n" + certSerialNumber.toString());
return sb.toString();
}
use of sun.misc.HexDumpEncoder in project jdk8u_jdk by JetBrains.
the class CertId method encode.
/**
* Encode the CertId using ASN.1 DER.
* The hash algorithm used is SHA-1.
*/
public void encode(DerOutputStream out) throws IOException {
DerOutputStream tmp = new DerOutputStream();
hashAlgId.encode(tmp);
tmp.putOctetString(issuerNameHash);
tmp.putOctetString(issuerKeyHash);
certSerialNumber.encode(tmp);
out.write(DerValue.tag_Sequence, tmp);
if (debug) {
HexDumpEncoder encoder = new HexDumpEncoder();
System.out.println("Encoded certId is " + encoder.encode(out.toByteArray()));
}
}
use of sun.misc.HexDumpEncoder in project jdk8u_jdk by JetBrains.
the class X509CRLImpl method toString.
/**
* Returns a printable string of this CRL.
*
* @return value of this CRL in a printable form.
*/
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append("X.509 CRL v" + (version + 1) + "\n");
if (sigAlgId != null)
sb.append("Signature Algorithm: " + sigAlgId.toString() + ", OID=" + (sigAlgId.getOID()).toString() + "\n");
if (issuer != null)
sb.append("Issuer: " + issuer.toString() + "\n");
if (thisUpdate != null)
sb.append("\nThis Update: " + thisUpdate.toString() + "\n");
if (nextUpdate != null)
sb.append("Next Update: " + nextUpdate.toString() + "\n");
if (revokedList.isEmpty())
sb.append("\nNO certificates have been revoked\n");
else {
sb.append("\nRevoked Certificates: " + revokedList.size());
int i = 1;
for (X509CRLEntry entry : revokedList) {
sb.append("\n[" + i++ + "] " + entry.toString());
}
}
if (extensions != null) {
Collection<Extension> allExts = extensions.getAllExtensions();
Object[] objs = allExts.toArray();
sb.append("\nCRL Extensions: " + objs.length);
for (int i = 0; i < objs.length; i++) {
sb.append("\n[" + (i + 1) + "]: ");
Extension ext = (Extension) objs[i];
try {
if (OIDMap.getClass(ext.getExtensionId()) == null) {
sb.append(ext.toString());
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: " + "DER encoded OCTET string =\n" + enc.encodeBuffer(extValue) + "\n");
}
} else
// sub-class exists
sb.append(ext.toString());
} catch (Exception e) {
sb.append(", Error parsing this extension");
}
}
}
if (signature != null) {
HexDumpEncoder encoder = new HexDumpEncoder();
sb.append("\nSignature:\n" + encoder.encodeBuffer(signature) + "\n");
} else
sb.append("NOT signed yet\n");
return sb.toString();
}
use of sun.misc.HexDumpEncoder in project jdk8u_jdk by JetBrains.
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);
}
use of sun.misc.HexDumpEncoder in project jdk8u_jdk by JetBrains.
the class DkCrypto method traceOutput.
static void traceOutput(String traceTag, byte[] output, int offset, int len) {
try {
ByteArrayOutputStream out = new ByteArrayOutputStream(len);
new HexDumpEncoder().encodeBuffer(new ByteArrayInputStream(output, offset, len), out);
System.err.println(traceTag + ":" + out.toString());
} catch (Exception e) {
}
}
Aggregations