1 files changed, 15 insertions, 0 deletions
diff --git a/crypto/src/openpgp/PgpUtilities.cs b/crypto/src/openpgp/PgpUtilities.cs
index 65c07b2e2..f982ae459 100644
--- a/crypto/src/openpgp/PgpUtilities.cs
+++ b/crypto/src/openpgp/PgpUtilities.cs
@@ -347,6 +347,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp
return MakeKey(algorithm, keyBytes);
}
+#if !PORTABLE
/// <summary>Write out the passed in file as a literal data packet.</summary>
public static void WriteFileToLiteralData(
Stream output,
@@ -384,6 +385,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp
pOut.Close();
inputStream.Close();
}
+#endif
private const int ReadAhead = 60;
@@ -488,5 +490,18 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp
throw new PgpException("unknown wrap algorithm: " + encAlgorithm);
}
}
+
+ internal static byte[] GenerateIV(int length, SecureRandom random)
+ {
+ byte[] iv = new byte[length];
+ random.NextBytes(iv);
+ return iv;
+ }
+
+ internal static S2k GenerateS2k(HashAlgorithmTag hashAlgorithm, int s2kCount, SecureRandom random)
+ {
+ byte[] iv = GenerateIV(8, random);
+ return new S2k(hashAlgorithm, iv, s2kCount);
+ }
}
}
|