File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
pg/src/main/java/org/bouncycastle/openpgp Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change 1111import org .bouncycastle .bcpg .BCPGOutputStream ;
1212import org .bouncycastle .bcpg .HashAlgorithmTags ;
1313import org .bouncycastle .bcpg .PacketTags ;
14+ import org .bouncycastle .bcpg .SymmetricEncDataPacket ;
1415import org .bouncycastle .bcpg .SymmetricEncIntegrityPacket ;
1516import org .bouncycastle .bcpg .SymmetricKeyAlgorithmTags ;
1617import org .bouncycastle .openpgp .operator .PBEKeyEncryptionMethodGenerator ;
@@ -260,10 +261,17 @@ else if (directS2K)
260261 // OpenPGP v4
261262 else // data is encrypted by v1 SEIPD or SED packet, so write v4 SKESK packet
262263 {
263- encOut = SymmetricEncIntegrityPacket .createVersion1Packet ();
264- if (digestCalc != null && useOldFormat )
264+ if (digestCalc != null )
265+ {
266+ encOut = SymmetricEncIntegrityPacket .createVersion1Packet ();
267+ if (useOldFormat )
268+ {
269+ throw new PGPException ("symmetric-enc-integrity packets not supported in old PGP format" );
270+ }
271+ }
272+ else
265273 {
266- throw new PGPException ( "symmetric-enc-integrity packets not supported in old PGP format" );
274+ encOut = new SymmetricEncDataPacket ( );
267275 }
268276
269277 if (buffer == null )
You can’t perform that action at this time.
0 commit comments