Esempio n. 1
0
        protected void CreateEncryptionInfoEntry(DirectoryNode dir)
        {
            DataSpaceMapUtils.AddDefaultDataSpace(dir);
            EncryptionInfo              info     = builder.GetEncryptionInfo();
            CryptoAPIEncryptionHeader   header   = builder.GetHeader();
            CryptoAPIEncryptionVerifier verifier = builder.GetVerifier();
            EncryptionRecord            er       = new EncryptionRecordInternal(info, header, verifier);

            DataSpaceMapUtils.CreateEncryptionEntry(dir, "EncryptionInfo", er);
        }
        /**
         * Initialize the builder from a stream
         */
        public void Initialize(EncryptionInfo info, ILittleEndianInput dis)
        {
            this.info = info;
            int hSize = dis.ReadInt();

            header    = new CryptoAPIEncryptionHeader(dis);
            verifier  = new CryptoAPIEncryptionVerifier(dis, header);
            decryptor = new CryptoAPIDecryptor(this);
            encryptor = new CryptoAPIEncryptor(this);
        }
        /**
         * Initialize the builder from scratch
         */
        public void Initialize(EncryptionInfo info,
                               CipherAlgorithm cipherAlgorithm, HashAlgorithm hashAlgorithm,
                               int keyBits, int blockSize, ChainingMode chainingMode)
        {
            this.info = info;
            if (cipherAlgorithm == null)
            {
                cipherAlgorithm = CipherAlgorithm.rc4;
            }
            if (hashAlgorithm == null)
            {
                hashAlgorithm = HashAlgorithm.sha1;
            }
            if (keyBits == -1)
            {
                keyBits = 0x28;
            }
            Debug.Assert(cipherAlgorithm == CipherAlgorithm.rc4 && hashAlgorithm == HashAlgorithm.sha1);

            header    = new CryptoAPIEncryptionHeader(cipherAlgorithm, hashAlgorithm, keyBits, blockSize, chainingMode);
            verifier  = new CryptoAPIEncryptionVerifier(cipherAlgorithm, hashAlgorithm, keyBits, blockSize, chainingMode);
            decryptor = new CryptoAPIDecryptor(this);
            encryptor = new CryptoAPIEncryptor(this);
        }
Esempio n. 4
0
 protected internal CryptoAPIEncryptionVerifier(ILittleEndianInput is1,
                                                CryptoAPIEncryptionHeader header) :
     base(is1, header)
 {
 }