/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
*/
/*
* Copyright 2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
/*
*/
/*
* $Id: DOMX509Data.java,v 1.2 2008/07/24 15:20:32 mullan Exp $
*/
/**
* DOM-based implementation of X509Data.
*
* @author Sean Mullan
*/
//@@@ check for illegal combinations of data violating MUSTs in W3c spec
/**
* Creates a DOMX509Data.
*
* @param content a list of one or more X.509 data types. Valid types are
* {@link String} (subject names), <code>byte[]</code> (subject key ids),
* {@link java.security.cert.X509Certificate}, {@link X509CRL},
* or {@link javax.xml.dsig.XMLStructure} ({@link X509IssuerSerial}
* objects or elements from an external namespace). The list is
* defensively copied to protect against subsequent modification.
* @return a <code>X509Data</code>
* @throws NullPointerException if <code>content</code> is <code>null</code>
* @throws IllegalArgumentException if <code>content</code> is empty
* @throws ClassCastException if <code>content</code> contains any entries
* that are not of one of the valid types mentioned above
*/
throw new NullPointerException("content cannot be null");
}
if (contentCopy.isEmpty()) {
throw new IllegalArgumentException("content cannot be empty");
}
} else if (!(x509Type instanceof byte[]) &&
!(x509Type instanceof X509Certificate) &&
!(x509Type instanceof XMLStructure)) {
throw new ClassCastException
("content["+i+"] is not a valid X509Data type");
}
}
}
/**
* Creates a <code>DOMX509Data</code> from an element.
*
* @param xdElem an X509Data element
* @throws MarshalException if there is an error while unmarshalling
*/
// get all children nodes
for (int i = 0; i < length; i++) {
// ignore all non-Element nodes
continue;
}
try {
} catch (Base64DecodingException bde) {
}
} else {
}
}
}
return content;
}
throws MarshalException {
// append children and preserve order
if (object instanceof X509Certificate) {
} else if (object instanceof XMLStructure) {
if (object instanceof X509IssuerSerial) {
} else {
}
} else if (object instanceof byte[]) {
}
}
}
}
}
try {
} catch (CertificateEncodingException e) {
throw new MarshalException("Error encoding X509Certificate", e);
}
}
try {
} catch (CRLException e) {
throw new MarshalException("Error encoding X509CRL", e);
}
}
throws MarshalException {
try {
} catch (CertificateException e) {
throw new MarshalException("Cannot create X509Certificate", e);
}
}
try {
} catch (CRLException e) {
throw new MarshalException("Cannot create X509CRL", e);
}
}
throws MarshalException {
try {
}
} catch (CertificateException e) {
throw new MarshalException("Cannot create CertificateFactory", e);
} catch (Base64DecodingException bde) {
}
}
if (this == o) {
return true;
}
if (!(o instanceof X509Data)) {
return false;
}
return false;
}
for (int i = 0; i < size; i++) {
if (x instanceof byte[]) {
if (!(ox instanceof byte[]) ||
return false;
}
} else {
return false;
}
}
}
return true;
}
}