Пример #1
0
 /// <summary>
 /// Create a new key ring generator.
 /// </summary>
 /// <param name="certificationLevel">The certification level for keys on this ring.</param>
 /// <param name="masterKey">The master key pair.</param>
 /// <param name="id">The id to be associated with the ring.</param>
 /// <param name="encAlgorithm">The algorithm to be used to protect secret keys.</param>
 /// <param name="utf8PassPhrase">
 /// If true, conversion of the passphrase to bytes uses Encoding.UTF8.GetBytes(), otherwise the conversion
 /// is performed using Convert.ToByte(), which is the historical behaviour of the library (1.7 and earlier).
 /// </param>
 /// <param name="passPhrase">The passPhrase to be used to protect secret keys.</param>
 /// <param name="useSha1">Checksum the secret keys with SHA1 rather than the older 16 bit checksum.</param>
 /// <param name="hashedPackets">Packets to be included in the certification hash.</param>
 /// <param name="unhashedPackets">Packets to be attached unhashed to the certification.</param>
 /// <param name="rand">input secured random.</param>
 public PgpKeyRingGenerator(
     int certificationLevel,
     PgpKeyPair masterKey,
     string id,
     SymmetricKeyAlgorithmTag encAlgorithm,
     bool utf8PassPhrase,
     char[]                                              passPhrase,
     bool useSha1,
     PgpSignatureSubpacketVector hashedPackets,
     PgpSignatureSubpacketVector unhashedPackets,
     SecureRandom rand)
     : this(certificationLevel, masterKey, id, encAlgorithm,
            PgpUtilities.EncodePassPhrase(passPhrase, utf8PassPhrase),
            useSha1, hashedPackets, unhashedPackets, rand)
 {
 }
Пример #2
0
 /// <summary>Return the decrypted input stream, using the passed in passphrase.</summary>
 /// <remarks>
 /// The passphrase is encoded to bytes using UTF8 (Encoding.UTF8.GetBytes).
 /// </remarks>
 public Stream GetDataStreamUtf8(char[] passPhrase)
 {
     return(DoGetDataStream(PgpUtilities.EncodePassPhrase(passPhrase, true), true));
 }
Пример #3
0
 /// <summary>Add a PBE encryption method to the encrypted object.</summary>
 /// <remarks>
 /// The passphrase is encoded to bytes using UTF8 (Encoding.UTF8.GetBytes).
 /// </remarks>
 public void AddMethodUtf8(char[] passPhrase, HashAlgorithmTag s2kDigest)
 {
     DoAddMethod(PgpUtilities.EncodePassPhrase(passPhrase, true), true, s2kDigest);
 }