@@ -80,7 +80,7 @@ private async Task OutputEncryptedAsync(Stream inputStream, Stream outputStream,
80
80
using ( Stream compressedOut = ChainCompressedOut ( encryptedOut ) )
81
81
{
82
82
PgpSignatureGenerator signatureGenerator = InitSignatureGenerator ( compressedOut ) ;
83
- using ( Stream literalOut = ChainLiteralStreamOut ( compressedOut , inputStream , name , oldFormat ) )
83
+ using ( Stream literalOut = ChainLiteralOut ( compressedOut , inputStream , name , oldFormat ) )
84
84
{
85
85
await WriteOutputAndSignAsync ( compressedOut , literalOut , inputStream , signatureGenerator ) ;
86
86
}
@@ -117,7 +117,7 @@ private void OutputEncrypted(Stream inputStream, Stream outputStream, bool withI
117
117
using ( Stream compressedOut = ChainCompressedOut ( encryptedOut ) )
118
118
{
119
119
PgpSignatureGenerator signatureGenerator = InitSignatureGenerator ( compressedOut ) ;
120
- using ( Stream literalOut = ChainLiteralStreamOut ( compressedOut , inputStream , name , oldFormat ) )
120
+ using ( Stream literalOut = ChainLiteralOut ( compressedOut , inputStream , name , oldFormat ) )
121
121
{
122
122
WriteOutputAndSign ( compressedOut , literalOut , inputStream , signatureGenerator ) ;
123
123
}
@@ -150,7 +150,7 @@ private async Task OutputSignedAsync(Stream inputStream, Stream outputStream,
150
150
using ( Stream compressedOut = ChainCompressedOut ( outputStream ) )
151
151
{
152
152
PgpSignatureGenerator signatureGenerator = InitSignatureGenerator ( compressedOut ) ;
153
- using ( Stream literalOut = ChainLiteralStreamOut ( compressedOut , inputStream , name , oldFormat ) )
153
+ using ( Stream literalOut = ChainLiteralOut ( compressedOut , inputStream , name , oldFormat ) )
154
154
{
155
155
await WriteOutputAndSignAsync ( compressedOut , literalOut , inputStream , signatureGenerator ) ;
156
156
}
@@ -181,7 +181,7 @@ private void OutputSigned(Stream inputStream, Stream outputStream, string name,
181
181
using ( Stream compressedOut = ChainCompressedOut ( outputStream ) )
182
182
{
183
183
PgpSignatureGenerator signatureGenerator = InitSignatureGenerator ( compressedOut ) ;
184
- using ( Stream literalOut = ChainLiteralStreamOut ( compressedOut , inputStream , name , oldFormat ) )
184
+ using ( Stream literalOut = ChainLiteralOut ( compressedOut , inputStream , name , oldFormat ) )
185
185
{
186
186
WriteOutputAndSign ( compressedOut , literalOut , inputStream , signatureGenerator ) ;
187
187
}
@@ -390,34 +390,31 @@ private Stream ChainCompressedOut(Stream encryptedOut)
390
390
private Stream ChainLiteralOut ( Stream compressedOut , FileInfo file , string name , bool oldFormat )
391
391
{
392
392
PgpLiteralDataGenerator pgpLiteralDataGenerator = new PgpLiteralDataGenerator ( oldFormat ) ;
393
- return pgpLiteralDataGenerator . Open ( compressedOut , FileTypeToChar ( ) , name , file . Length ,
393
+
394
+ return pgpLiteralDataGenerator . Open ( compressedOut , FileTypeToChar ( ) , name , file . Length ,
394
395
DateTime . UtcNow ) ;
395
396
}
396
397
397
- #endregion ChainLiteralOut
398
-
399
- #region ChainLiteralStreamOut
400
-
401
- private Stream ChainLiteralStreamOut ( Stream compressedOut , Stream inputStream , string name , bool oldFormat )
398
+ private Stream ChainLiteralOut ( Stream compressedOut , Stream inputStream , string name , bool oldFormat )
402
399
{
403
400
PgpLiteralDataGenerator pgpLiteralDataGenerator = new PgpLiteralDataGenerator ( oldFormat ) ;
404
401
return pgpLiteralDataGenerator . Open ( compressedOut , FileTypeToChar ( ) , name , inputStream . Length ,
405
402
DateTime . UtcNow ) ;
406
403
}
407
404
408
- #endregion ChainLiteralStreamOut
405
+ #endregion ChainLiteralOut
409
406
410
- #region InitSignatureGenerator
407
+ #region InitSignatureGenerator
411
408
412
- private PgpSignatureGenerator InitSignatureGenerator ( Stream compressedOut )
409
+ private PgpSignatureGenerator InitSignatureGenerator ( Stream compressedOut )
413
410
{
414
411
PublicKeyAlgorithmTag tag = EncryptionKeys . SigningSecretKey . PublicKey . Algorithm ;
415
412
PgpSignatureGenerator pgpSignatureGenerator = new PgpSignatureGenerator ( tag , HashAlgorithmTag ) ;
416
413
pgpSignatureGenerator . InitSign ( PgpSignature . BinaryDocument , EncryptionKeys . SigningPrivateKey ) ;
417
414
foreach ( string userId in EncryptionKeys . SigningSecretKey . PublicKey . GetUserIds ( ) )
418
415
{
419
416
PgpSignatureSubpacketGenerator subPacketGenerator = new PgpSignatureSubpacketGenerator ( ) ;
420
- subPacketGenerator . SetSignerUserId ( false , userId ) ;
417
+ subPacketGenerator . AddSignerUserId ( false , userId ) ;
421
418
pgpSignatureGenerator . SetHashedSubpackets ( subPacketGenerator . Generate ( ) ) ;
422
419
// Just the first one!
423
420
break ;
@@ -440,7 +437,7 @@ private PgpSignatureGenerator InitClearSignatureGenerator(ArmoredOutputStream ar
440
437
foreach ( string userId in EncryptionKeys . SigningSecretKey . PublicKey . GetUserIds ( ) )
441
438
{
442
439
PgpSignatureSubpacketGenerator subPacketGenerator = new PgpSignatureSubpacketGenerator ( ) ;
443
- subPacketGenerator . SetSignerUserId ( false , userId ) ;
440
+ subPacketGenerator . AddSignerUserId ( false , userId ) ;
444
441
pgpSignatureGenerator . SetHashedSubpackets ( subPacketGenerator . Generate ( ) ) ;
445
442
// Just the first one!
446
443
break ;
0 commit comments