0N/A/*
0N/A * reserved comment block
0N/A * DO NOT REMOVE OR ALTER!
0N/A */
0N/A/*
0N/A * Copyright 1999-2004 The Apache Software Foundation.
0N/A *
0N/A * Licensed under the Apache License, Version 2.0 (the "License");
0N/A * you may not use this file except in compliance with the License.
0N/A * You may obtain a copy of the License at
0N/A *
0N/A * http://www.apache.org/licenses/LICENSE-2.0
0N/A *
0N/A * Unless required by applicable law or agreed to in writing, software
0N/A * distributed under the License is distributed on an "AS IS" BASIS,
0N/A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0N/A * See the License for the specific language governing permissions and
0N/A * limitations under the License.
0N/A *
0N/A */
0N/Apackage com.sun.org.apache.xml.internal.security.keys;
0N/A
0N/A
0N/A
0N/Aimport java.io.PrintStream;
0N/Aimport java.security.PublicKey;
0N/A
0N/Aimport com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException;
0N/Aimport com.sun.org.apache.xml.internal.security.keys.content.KeyName;
0N/Aimport com.sun.org.apache.xml.internal.security.keys.content.KeyValue;
0N/Aimport com.sun.org.apache.xml.internal.security.keys.content.MgmtData;
0N/Aimport com.sun.org.apache.xml.internal.security.keys.content.X509Data;
0N/A
0N/A
0N/A/**
0N/A * Utility class for for <CODE>com.sun.org.apache.xml.internal.security.keys</CODE> package.
0N/A *
661N/A * @author $Author: mullan $
0N/A */
0N/Apublic class KeyUtils {
0N/A
0N/A private KeyUtils() {
0N/A // no instantiation
0N/A }
0N/A
0N/A /**
0N/A * Method prinoutKeyInfo
0N/A *
0N/A * @param ki
0N/A * @param os
0N/A * @throws XMLSecurityException
0N/A */
0N/A public static void prinoutKeyInfo(KeyInfo ki, PrintStream os)
0N/A throws XMLSecurityException {
0N/A
0N/A for (int i = 0; i < ki.lengthKeyName(); i++) {
0N/A KeyName x = ki.itemKeyName(i);
0N/A
0N/A os.println("KeyName(" + i + ")=\"" + x.getKeyName() + "\"");
0N/A }
0N/A
0N/A for (int i = 0; i < ki.lengthKeyValue(); i++) {
0N/A KeyValue x = ki.itemKeyValue(i);
0N/A PublicKey pk = x.getPublicKey();
0N/A
0N/A os.println("KeyValue Nr. " + i);
0N/A os.println(pk);
0N/A }
0N/A
0N/A for (int i = 0; i < ki.lengthMgmtData(); i++) {
0N/A MgmtData x = ki.itemMgmtData(i);
0N/A
0N/A os.println("MgmtData(" + i + ")=\"" + x.getMgmtData() + "\"");
0N/A }
0N/A
0N/A for (int i = 0; i < ki.lengthX509Data(); i++) {
0N/A X509Data x = ki.itemX509Data(i);
0N/A
0N/A os.println("X509Data(" + i + ")=\"" + (x.containsCertificate()
0N/A ? "Certificate "
0N/A : "") + (x
0N/A .containsIssuerSerial()
0N/A ? "IssuerSerial "
0N/A : "") + "\"");
0N/A }
0N/A }
0N/A}