/**
         * 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);
        }
示例#3
0
 public CipherByteArrayOutputStream(CryptoAPIEncryptor encryptor)
     : base()
 {
     this.encryptor = encryptor;
 }