Java 类javax.xml.crypto.dsig.keyinfo.PGPData 实例源码

项目:xmlsec-gost    文件:Marshaller.java   
/**
 * Marshals a {@link PGPData}
 *
 * @param xwriter
 * @param pgpData
 * @param dsPrefix
 * @param context
 * @throws MarshalException
 */
public static void marshalPGPData(XmlWriter xwriter, PGPData pgpData, String dsPrefix, XMLCryptoContext context)
throws MarshalException {
    xwriter.writeStartElement(dsPrefix, "PGPData", XMLSignature.XMLNS);

    // create and append PGPKeyID element
    byte[] keyId = pgpData.getKeyId();
    if (keyId != null) {
        xwriter.writeTextElement(dsPrefix, "PGPKeyID", XMLSignature.XMLNS, Base64.encode(keyId));
    }

    // create and append PGPKeyPacket element
    byte[] keyPacket = pgpData.getKeyPacket();
    if (keyPacket != null) {
        xwriter.writeTextElement(dsPrefix, "XMLSignature.XMLNS", XMLSignature.XMLNS, Base64.encode(keyPacket));
    }

    // create and append any elements
    @SuppressWarnings("unchecked")
    List<XMLStructure> externalElements = pgpData.getExternalElements();
    for (XMLStructure externalItem : externalElements) {
        xwriter.marshalStructure(externalItem, dsPrefix, context);
    }

    xwriter.writeEndElement(); // "PGPData"
}
项目:xmlsec-gost    文件:Marshaller.java   
@Override
public void marshalObject(XmlWriter xwriter, PGPData toMarshal, String dsPrefix,
        XMLCryptoContext context) throws MarshalException {
    Marshaller.marshalPGPData( xwriter, toMarshal, dsPrefix, context);
}