Search in sources :

Example 1 with KeyName

use of com.sun.org.apache.xml.internal.security.keys.content.KeyName in project jdk8u_jdk by JetBrains.

the class KeyUtils method prinoutKeyInfo.

/**
     * Method prinoutKeyInfo
     *
     * @param ki
     * @param os
     * @throws XMLSecurityException
     */
public static void prinoutKeyInfo(KeyInfo ki, PrintStream os) throws XMLSecurityException {
    for (int i = 0; i < ki.lengthKeyName(); i++) {
        KeyName x = ki.itemKeyName(i);
        os.println("KeyName(" + i + ")=\"" + x.getKeyName() + "\"");
    }
    for (int i = 0; i < ki.lengthKeyValue(); i++) {
        KeyValue x = ki.itemKeyValue(i);
        PublicKey pk = x.getPublicKey();
        os.println("KeyValue Nr. " + i);
        os.println(pk);
    }
    for (int i = 0; i < ki.lengthMgmtData(); i++) {
        MgmtData x = ki.itemMgmtData(i);
        os.println("MgmtData(" + i + ")=\"" + x.getMgmtData() + "\"");
    }
    for (int i = 0; i < ki.lengthX509Data(); i++) {
        X509Data x = ki.itemX509Data(i);
        os.println("X509Data(" + i + ")=\"" + (x.containsCertificate() ? "Certificate " : "") + (x.containsIssuerSerial() ? "IssuerSerial " : "") + "\"");
    }
}
Also used : KeyName(com.sun.org.apache.xml.internal.security.keys.content.KeyName) KeyValue(com.sun.org.apache.xml.internal.security.keys.content.KeyValue) MgmtData(com.sun.org.apache.xml.internal.security.keys.content.MgmtData) PublicKey(java.security.PublicKey) X509Data(com.sun.org.apache.xml.internal.security.keys.content.X509Data)

Aggregations

KeyName (com.sun.org.apache.xml.internal.security.keys.content.KeyName)1 KeyValue (com.sun.org.apache.xml.internal.security.keys.content.KeyValue)1 MgmtData (com.sun.org.apache.xml.internal.security.keys.content.MgmtData)1 X509Data (com.sun.org.apache.xml.internal.security.keys.content.X509Data)1 PublicKey (java.security.PublicKey)1