The string to key specifier class.
Наследование: BcpgObject
Пример #1
0
        internal SecretKeyPacket(
            BcpgInputStream bcpgIn)
        {
            pubKeyPacket = new PublicKeyPacket(bcpgIn);

            s2kUsage = bcpgIn.ReadByte();

            if (s2kUsage == UsageChecksum || s2kUsage == UsageSha1)
            {
                encAlgorithm = (SymmetricKeyAlgorithmTag) bcpgIn.ReadByte();
                s2k = new S2k(bcpgIn);
            }
            else
            {
                encAlgorithm = (SymmetricKeyAlgorithmTag) s2kUsage;
            }

            if (!(s2k != null && s2k.Type == S2k.GnuDummyS2K && s2k.ProtectionMode == 0x01))
            {
                if (s2kUsage != 0)
                {
                    if (((int) encAlgorithm) < 7)
                    {
                        iv = new byte[8];
                    }
                    else
                    {
                        iv = new byte[16];
                    }
                    bcpgIn.ReadFully(iv);
                }
            }

            secKeyData = bcpgIn.ReadAll();
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="SymmetricKeyEncSessionPacket"/> class.
 /// </summary>
 /// <param name="encAlgorithm">The enc algorithm.</param>
 /// <param name="s2k">The S2K.</param>
 /// <param name="secKeyData">The sec key data.</param>
 public SymmetricKeyEncSessionPacket(SymmetricKeyAlgorithmTag encAlgorithm, S2k s2k, byte[] secKeyData)
 {
     this.Version = 4;
     this.EncAlgorithm = encAlgorithm;
     this.S2K = s2k;
     this._secKeyData = secKeyData;
 }
		public SecretSubkeyPacket(
            PublicKeyPacket				pubKeyPacket,
            SymmetricKeyAlgorithmTag	encAlgorithm,
            S2k							s2k,
            byte[]						iv,
            byte[]						secKeyData)
            : base(pubKeyPacket, encAlgorithm, s2k, iv, secKeyData)
        {
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SymmetricKeyEncSessionPacket"/> class.
        /// </summary>
        /// <param name="bcpgIn">The BCPG in.</param>
        public SymmetricKeyEncSessionPacket(BcpgInputStream bcpgIn)
        {
            Version = bcpgIn.ReadByte();
            EncAlgorithm = (SymmetricKeyAlgorithmTag)bcpgIn.ReadByte();

            S2K = new S2k(bcpgIn);

            _secKeyData = bcpgIn.ReadAll();
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="SecretKeyPacket"/> class.
 /// </summary>
 /// <param name="pubKeyPacket">The pub key packet.</param>
 /// <param name="encAlgorithm">The enc algorithm.</param>
 /// <param name="s2KUsage">The s2 K usage.</param>
 /// <param name="s2K">The s2 K.</param>
 /// <param name="iv">The iv.</param>
 /// <param name="secKeyData">The sec key data.</param>
 public SecretKeyPacket(IPublicKeyPacket pubKeyPacket, SymmetricKeyAlgorithmTag encAlgorithm, int s2KUsage, S2k s2K, byte[] iv, byte[] secKeyData)
 {
     this.PublicKeyPacket = pubKeyPacket;
     this.EncAlgorithm = encAlgorithm;
     this.S2KUsage = s2KUsage;
     this.S2K = s2K;
     _iv = Arrays.Clone(iv);
     _secKeyData = secKeyData;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="SecretKeyPacket"/> class.
        /// </summary>
        /// <param name="pubKeyPacket">The pub key packet.</param>
        /// <param name="encAlgorithm">The enc algorithm.</param>
        /// <param name="s2K">The s2 K.</param>
        /// <param name="iv">The iv.</param>
        /// <param name="secKeyData">The sec key data.</param>
        public SecretKeyPacket(IPublicKeyPacket pubKeyPacket, SymmetricKeyAlgorithmTag encAlgorithm, S2k s2K, byte[] iv, byte[] secKeyData)
        {
            this.PublicKeyPacket = pubKeyPacket;
            this.EncAlgorithm = encAlgorithm;

            this.S2KUsage = encAlgorithm != SymmetricKeyAlgorithmTag.Null ? UsageChecksum : UsageNone;

            this.S2K = s2K;
            _iv = Arrays.Clone(iv);
            _secKeyData = secKeyData;
        }
Пример #7
0
        public SecretKeyPacket(
			PublicKeyPacket				pubKeyPacket,
			SymmetricKeyAlgorithmTag	encAlgorithm,
			int							s2kUsage,
			S2k							s2k,
			byte[]						iv,
			byte[]						secKeyData)
        {
            this.pubKeyPacket = pubKeyPacket;
            this.encAlgorithm = encAlgorithm;
            this.s2kUsage = s2kUsage;
            this.s2k = s2k;
            this.iv = Arrays.Clone(iv);
            this.secKeyData = secKeyData;
        }
Пример #8
0
		public SecretKeyPacket(
            PublicKeyPacket				pubKeyPacket,
            SymmetricKeyAlgorithmTag	encAlgorithm,
            S2k							s2k,
            byte[]						iv,
            byte[]						secKeyData)
        {
            this.pubKeyPacket = pubKeyPacket;
            this.encAlgorithm = encAlgorithm;

			if (encAlgorithm != SymmetricKeyAlgorithmTag.Null)
			{
				this.s2kUsage = UsageChecksum;
			}
			else
			{
				this.s2kUsage = UsageNone;
			}

			this.s2k = s2k;
			this.iv = Arrays.Clone(iv);
			this.secKeyData = secKeyData;
        }
Пример #9
0
 public SecretKeyPacket(PublicKeyPacket pubKeyPacket, SymmetricKeyAlgorithmTag encAlgorithm, S2k s2k, byte[] iv, byte[] secKeyData)
 {
     this.pubKeyPacket = pubKeyPacket;
     this.encAlgorithm = encAlgorithm;
     if (encAlgorithm != SymmetricKeyAlgorithmTag.Null)
     {
         this.s2kUsage = 255;
     }
     else
     {
         this.s2kUsage = 0;
     }
     this.s2k        = s2k;
     this.iv         = Arrays.Clone(iv);
     this.secKeyData = secKeyData;
 }
Пример #10
0
 public SecretKeyPacket(PublicKeyPacket pubKeyPacket, SymmetricKeyAlgorithmTag encAlgorithm, int s2kUsage, S2k s2k, byte[] iv, byte[] secKeyData)
 {
     this.pubKeyPacket = pubKeyPacket;
     this.encAlgorithm = encAlgorithm;
     this.s2kUsage     = s2kUsage;
     this.s2k          = s2k;
     this.iv           = Arrays.Clone(iv);
     this.secKeyData   = secKeyData;
 }