우리 응용 프로그램은 this one과 비슷한 KeyBasedFileProcessor.cs에서 수정 한 것을 사용하여 PG 암호화 파일을 해독합니다. 일반적으로 이것은 정상적으로 작동하지만 특정 파일에 문제가 발생했습니다. 문제가있는 코드는 다음과 같습니다 :BouncyCastle에서 PgpLiteralData를 예상 할 때 PgpMarker가 나타나는 이유는 무엇입니까?
if (message is PgpLiteralData)
{
PgpLiteralData ld = (PgpLiteralData)message;
Stream fOut = File.Create(ld.FileName);
Stream unc = ld.GetInputStream();
Streams.PipeAll(unc, fOut);
fOut.Close();
}
else if (message is PgpOnePassSignatureList)
{
throw new PgpException("encrypted message contains a signed message - not literal data.");
}
else
{
// the code goes here and throw this exception, when I debug, message is of type PgpMarker
throw new PgpException("message is not a simple encrypted file - type unknown.");
}
이 부분에서 나는 코드가 PgpLiteralData를 기대하고있다 생각합니다. 하지만 대신 PgpMarker가 생겨 예외가 발생합니다. PgpMarker가있는 이유는 무엇입니까? 대신 PgpLiteralData를 찾는 방법은 무엇입니까?
마커를 건너 뛰었습니까? 이는 Bouncy Castle Java API에서 가져온 것입니다. "PGP 마커 패킷 - 일반적으로 원본 입력 스트림을 유지하는 것 이외에는 무시해야합니다." –