小编pvk*_*cse的帖子

Pgp 签名+加密然后解密+验证

在使用符号加密然后解密和验证时,我在验证时不断在流中获取未知对象。消息完整性检查已通过,但是当我尝试在解密后的下一行进行验证时,出现上述错误。

    private static void encryptFile(
    String outFileName,
    OutputStream out,
    String fileName,
    PGPPublicKey encKey,
    String sKeyFileName,
    char[] passPhrase,
    boolean armor,
    boolean withIntegrityCheck)
    throws Exception
{
    if (armor)
    {
        out = new ArmoredOutputStream(out);
    }

    try
    {


        byte[] bytes = PGPKeyUtil.compressFile(fileName, CompressionAlgorithmTags.ZIP);


        PGPEncryptedDataGenerator encGen = new PGPEncryptedDataGenerator(
            PGPEncryptedData.CAST5, withIntegrityCheck, new SecureRandom(), "BC");
        encGen.addMethod(encKey);

        OutputStream cOut = encGen.open(out, bytes.length);

        cOut.write(bytes);
        cOut.close();
        out.close();

        cOut.close();


        if (armor)
        {
            out.close();
        }

        encGen.close();

    }
    catch (PGPException e)
    {
        System.err.println(e);
        if (e.getUnderlyingException() != null)
        {
            e.getUnderlyingException().printStackTrace();
        }
    }
} …
Run Code Online (Sandbox Code Playgroud)

java encryption bouncycastle sign pgp

3
推荐指数
1
解决办法
6649
查看次数

List.nub超出范围

它说List.nub超出范围......

import Data.List
  main=do
    line <- getLine
    putStrLn (List.nub words line)
Run Code Online (Sandbox Code Playgroud)

我对如何克服这个问题一无所知.

haskell

-3
推荐指数
1
解决办法
590
查看次数

标签 统计

bouncycastle ×1

encryption ×1

haskell ×1

java ×1

pgp ×1

sign ×1