第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

使用 Apache Camel 進(jìn)行 PGP 加密

使用 Apache Camel 進(jìn)行 PGP 加密

忽然笑 2023-06-14 10:51:28
我正在嘗試使用 Apache Camel 的 PGP 加密/解密方法來加密和解密文件。此外,我還安裝了Kleopatra來生成私鑰和公鑰。使用 Kleopatra 我已經(jīng)成功地生成了我的密鑰。密鑰和公鑰以“.asc”為擴(kuò)展名。下面是我用來加密文件的代碼import org.apache.camel.CamelContext;import org.apache.camel.builder.RouteBuilder;import org.apache.camel.impl.DefaultCamelContext;public class PGPENC {    public static void main(String[] args) throws Exception {        CamelContext camelContext = new DefaultCamelContext();        camelContext.addRoutes(new RouteBuilder() {            public void configure() throws Exception {                String publicKeyFileName = "file:C:\\Users\\karthick\\Desktop\\PGP\\PGP\\Public_Key.asc";                String keyUserid = "Karthick Sambanghi <karthick88it@gmail.com>";                from("file:C:\\Users\\ITSS\\karthick\\PGP\\PGP\\IN?noop=true;delete=true").marshal()                        .pgp(publicKeyFileName, keyUserid).to("file:C:\\Users\\ITSS\\Desktop\\PGP\\PGP\\OUT");            }        });        camelContext.start();        Thread.sleep(5000);        camelContext.stop();    }}這里程序成功執(zhí)行,沒有任何錯(cuò)誤,但文件未在 OUT 文件夾中加密。無論如何檢查“camelContext”返回語句是成功還是失敗?以下是當(dāng)前用于執(zhí)行程序的庫bcpg-jdk15on-1.52bcprov-ext-jdk15on-1.57camel-context-2.22.1camel-core-2.22.1camel-crypto-2.19.1slf4j-api-1.7.25slf4j-nop-1.7.25
查看完整描述

1 回答

?
動(dòng)漫人物

TA貢獻(xiàn)1815條經(jīng)驗(yàn) 獲得超10個(gè)贊

您可以通過在您的程序中添加來在控制臺(tái)中啟用駱駝日志記錄org.apache.log4j.BasicConfigurator.configure()。


使用它,您可以驗(yàn)證路由是否啟動(dòng)并使用了文件。所以通過添加一些日志來執(zhí)行你的程序:


?CamelContext camelContext = new DefaultCamelContext();

? ? BasicConfigurator.configure();

? ? camelContext.addRoutes(new RouteBuilder() {


? ? ? public void configure() throws Exception {


? ? ? ? String publicKeyFileName = "file:C:\\LocalData\\Keys\\pgp_public.asc";

? ? ? ? String keyUserid = " ";


? ? ? ? from("file:C:\\Test\\Test\\IN")

? ? ? ? ? ? .log("file received")

? ? ? ? ? ? .marshal().pgp(publicKeyFileName, keyUserid)

? ? ? ? .to("file:C\\Test\\Test\\OUT");


? ? ? }

? ? });

? ? camelContext.start();

? ? Thread.sleep(30000);

? ? camelContext.stop();

? }?

我可以注意到路由正在啟動(dòng),使用 in 文件夾中的文件然后失敗,但出現(xiàn)以下異常:


Caused by: java.lang.NoSuchMethodError: org.bouncycastle.openpgp.PGPPublicKeyRingCollection.<init>(Ljava/io/InputStream;)V

? ? at org.apache.camel.converter.crypto.PGPDataFormatUtil.findPublicKey(PGPDataFormatUtil.java:64)

? ? at org.apache.camel.converter.crypto.PGPDataFormatUtil.findPublicKey(PGPDataFormatUtil.java:54)

? ? at org.apache.camel.converter.crypto.PGPDataFormat.marshal(PGPDataFormat.java:64)

? ? at org.apache.camel.processor.MarshalProcessor.process(MarshalProcessor.java:59)

? ? at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)


查看完整回答
反對(duì) 回復(fù) 2023-06-14
  • 1 回答
  • 0 關(guān)注
  • 174 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)