Esempio n. 1
0
 /// <summary>
 /// Create a new key ring generator.
 /// </summary>
 /// <remarks>
 /// Conversion of the passphrase characters to bytes is performed using Convert.ToByte(), which is
 /// the historical behaviour of the library (1.7 and earlier).
 /// </remarks>
 /// <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="hashAlgorithm">The hash algorithm.</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,
     HashAlgorithmTag hashAlgorithm,
     char[]                      passPhrase,
     bool useSha1,
     PgpSignatureSubpacketVector hashedPackets,
     PgpSignatureSubpacketVector unhashedPackets,
     SecureRandom rand)
     : this(certificationLevel, masterKey, id, encAlgorithm, hashAlgorithm, false, passPhrase, useSha1, hashedPackets, unhashedPackets, rand)
 {
 }
Esempio n. 2
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="rawPassPhrase">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,
            byte[]                                              rawPassPhrase,
            bool useSha1,
            PgpSignatureSubpacketVector hashedPackets,
            PgpSignatureSubpacketVector unhashedPackets,
            SecureRandom rand)
        {
            this.certificationLevel = certificationLevel;
            this.masterKey          = masterKey;
            this.id                   = id;
            this.encAlgorithm         = encAlgorithm;
            this.rawPassPhrase        = rawPassPhrase;
            this.useSha1              = useSha1;
            this.hashedPacketVector   = hashedPackets;
            this.unhashedPacketVector = unhashedPackets;
            this.rand                 = rand;

            keys.Add(new PgpSecretKey(certificationLevel, masterKey, id, encAlgorithm, rawPassPhrase, false, useSha1, hashedPackets, unhashedPackets, rand));
        }
Esempio n. 3
0
 /// <summary>
 /// Add a subkey to the key ring to be generated with default certification.
 /// </summary>
 /// <param name="keyPair">The key pair.</param>
 /// <param name="hashAlgorithm">The hash algorithm.</param>
 public void AddSubKey(PgpKeyPair keyPair, HashAlgorithmTag hashAlgorithm)
 {
     this.AddSubKey(keyPair, this.hashedPacketVector, this.unhashedPacketVector, hashAlgorithm);
 }
Esempio n. 4
0
 /// <summary>Add a subkey to the key ring to be generated with default certification.</summary>
 public void AddSubKey(
     PgpKeyPair keyPair)
 {
     AddSubKey(keyPair, this.hashedPacketVector, this.unhashedPacketVector);
 }