|
Java example source code file (DOMPGPData.java)
The DOMPGPData.java Java example source code/* * reserved comment block * DO NOT REMOVE OR ALTER! */ /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * 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. */ /* * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. */ /* * $Id: DOMPGPData.java 1203846 2011-11-18 21:18:17Z mullan $ */ package org.jcp.xml.dsig.internal.dom; import java.util.*; import javax.xml.crypto.*; import javax.xml.crypto.dom.DOMCryptoContext; import javax.xml.crypto.dsig.*; import javax.xml.crypto.dsig.keyinfo.PGPData; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import com.sun.org.apache.xml.internal.security.exceptions.Base64DecodingException; import com.sun.org.apache.xml.internal.security.utils.Base64; /** * DOM-based implementation of PGPData. * * @author Sean Mullan */ public final class DOMPGPData extends DOMStructure implements PGPData { private final byte[] keyId; private final byte[] keyPacket; private final List<XMLStructure> externalElements; /** * Creates a <code>DOMPGPData containing the specified key packet. * and optional list of external elements. * * @param keyPacket a PGP Key Material Packet as defined in section 5.5 of * <a href="http://www.ietf.org/rfc/rfc2440.txt"/>RFC 2440. The * array is cloned to prevent subsequent modification. * @param other a list of {@link XMLStructure}s representing elements from * an external namespace. The list is defensively copied to prevent * subsequent modification. May be <code>null or empty. * @throws NullPointerException if <code>keyPacket is * <code>null * @throws IllegalArgumentException if the key packet is not in the * correct format * @throws ClassCastException if <code>other contains any * entries that are not of type {@link XMLStructure} */ public DOMPGPData(byte[] keyPacket, List<? extends XMLStructure> other) { if (keyPacket == null) { throw new NullPointerException("keyPacket cannot be null"); } if (other == null || other.isEmpty()) { this.externalElements = Collections.emptyList(); } else { this.externalElements = Collections.unmodifiableList(new ArrayList<XMLStructure>(other)); for (int i = 0, size = this.externalElements.size(); i < size; i++) { if (!(this.externalElements.get(i) instanceof XMLStructure)) { throw new ClassCastException ("other["+i+"] is not a valid PGPData type"); } } } this.keyPacket = (byte[])keyPacket.clone(); checkKeyPacket(keyPacket); this.keyId = null; } /** * Creates a <code>DOMPGPData containing the specified key id and * optional key packet and list of external elements. * * @param keyId a PGP public key id as defined in section 11.2 of * <a href="http://www.ietf.org/rfc/rfc2440.txt"/>RFC 2440. The * array is cloned to prevent subsequent modification. * @param keyPacket a PGP Key Material Packet as defined in section 5.5 of * <a href="http://www.ietf.org/rfc/rfc2440.txt"/>RFC 2440 (may * be <code>null). The array is cloned to prevent subsequent * modification. * @param other a list of {@link XMLStructure}s representing elements from * an external namespace. The list is defensively copied to prevent * subsequent modification. May be <code>null or empty. * @throws NullPointerException if <code>keyId is Other Java examples (source code examples)Here is a short list of links related to this Java DOMPGPData.java source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.