@Override public void write(LittleEndianByteArrayOutputStream bos) { // see [MS-OFFCRYPTO] - 2.3.4.9 byte salt[] = getSalt(); assert(salt.length == 16); bos.writeInt(salt.length); // salt size bos.write(salt); // The resulting Verifier value MUST be an array of 16 bytes. byte encryptedVerifier[] = getEncryptedVerifier(); assert(encryptedVerifier.length == 16); bos.write(encryptedVerifier); // The number of bytes used by the decrypted Verifier hash is given by // the VerifierHashSize field, which MUST be 20 bos.writeInt(20); // EncryptedVerifierHash: An array of bytes that contains the encrypted form of the hash of // the randomly generated Verifier value. The length of the array MUST be the size of the // encryption block size multiplied by the number of blocks needed to encrypt the hash of the // Verifier. If the encryption algorithm is RC4, the length MUST be 20 bytes. If the encryption // algorithm is AES, the length MUST be 32 bytes. After decrypting the EncryptedVerifierHash // field, only the first VerifierHashSize bytes MUST be used. byte encryptedVerifierHash[] = getEncryptedVerifierHash(); assert(encryptedVerifierHash.length == getCipherAlgorithm().encryptedVerifierHashLength); bos.write(encryptedVerifierHash); }
@Override public void write(LittleEndianByteArrayOutputStream bos) { // see [MS-OFFCRYPTO] - 2.3.4.9 byte salt[] = getSalt(); assert(salt.length == 16); bos.writeInt(salt.length); // salt size bos.write(salt); // The resulting Verifier value MUST be an array of 16 bytes. byte encryptedVerifier[] = getEncryptedVerifier(); assert(encryptedVerifier.length == 16); bos.write(encryptedVerifier); // The number of bytes used by the decrypted Verifier hash is given by // the VerifierHashSize field, which MUST be 20 bos.writeInt(20); // EncryptedVerifierHash: An array of bytes that contains the encrypted form of the hash of // the randomly generated Verifier value. The length of the array MUST be the size of the // encryption block size multiplied by the number of blocks needed to encrypt the hash of the // Verifier. If the encryption algorithm is RC4, the length MUST be 20 bytes. If the encryption // algorithm is AES, the length MUST be 32 bytes. After decrypting the EncryptedVerifierHash // field, only the first VerifierHashSize bytes MUST be used. byte encryptedVerifierHash[] = getEncryptedVerifierHash(); assert(encryptedVerifierHash.length == getCipherAlgorithm().encryptedVerifierHashLength); bos.write(encryptedVerifierHash); }