Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 11 for calculateMac (1.56 sec)

  1. src/test/java/jcifs/pac/PacMacTest.java

            // Test HMAC-MD5
            byte[] mac1 = PacMac.calculateMac(PacSignature.KERB_CHECKSUM_HMAC_MD5, keys, TEST_DATA);
            assertNotNull(mac1);
            assertEquals(16, mac1.length);
    
            // Test AES128
            byte[] mac2 = PacMac.calculateMac(PacSignature.HMAC_SHA1_96_AES128, keys, TEST_DATA);
            assertNotNull(mac2);
            assertEquals(12, mac2.length);
    
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Thu Aug 14 07:14:38 UTC 2025
    - 7.1K bytes
    - Viewed (0)
  2. src/test/java/jcifs/pac/PacTest.java

            try (MockedStatic<PacMac> pacMacMock = mockStatic(PacMac.class)) {
                // Mock the calculateMac method to return a valid checksum
                byte[] mockChecksum = new byte[16];
                pacMacMock.when(() -> PacMac.calculateMac(anyInt(), any(), any())).thenReturn(mockChecksum);
    
                // Create a minimal valid PAC structure
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Thu Aug 14 05:31:44 UTC 2025
    - 7.9K bytes
    - Viewed (0)
  3. src/main/java/jcifs/pac/Pac.java

                        this.serverSignature.getType(), Hexdump.toHexString(this.serverSignature.getChecksum())));
            }
    
            byte checksum[] = PacMac.calculateMac(this.serverSignature.getType(), keys, checksumData);
            if (!MessageDigest.isEqual(this.serverSignature.getChecksum(), checksum)) {
                if (log.isDebugEnabled()) {
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Sat Aug 16 01:32:48 UTC 2025
    - 7.3K bytes
    - Viewed (0)
  4. src/main/java/jcifs/pac/PacMac.java

         * @param data the data to calculate the MAC for
         * @return the calculated mac bytes
         * @throws PACDecodingException if the MAC calculation fails or required keys are missing
         */
        public static byte[] calculateMac(int type, Map<Integer, KerberosKey> keys, byte[] data) throws PACDecodingException {
            try {
                int usage = 17;
                if (type == PacSignature.KERB_CHECKSUM_HMAC_MD5) {
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Sat Aug 16 01:32:48 UTC 2025
    - 9K bytes
    - Viewed (0)
  5. src/test/java/jcifs/smb/SSPContextTest.java

                byte[] data = new byte[] { 1, 2 };
                if (mockCtx.supportsIntegrity() && mockCtx.isEstablished()) {
                    mockCtx.calculateMIC(data);
                }
    
                // Verify that calculateMIC was never called
                verify(mockCtx, never()).calculateMIC(any());
                // Verify that supportsIntegrity was checked once
                verify(mockCtx, times(1)).supportsIntegrity();
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Thu Aug 14 05:31:44 UTC 2025
    - 15.2K bytes
    - Viewed (0)
  6. src/test/java/jcifs/smb/Kerb5ContextTest.java

        }
    
        @Test
        @DisplayName("calculateMIC returns value from GSS and verifies interaction")
        void calculateMIC_success() throws Exception {
            byte[] data = new byte[] { 1, 2, 3 };
            byte[] mic = new byte[] { 9, 8 };
            when(gssContext.getMIC(eq(data), eq(0), eq(3), any())).thenReturn(mic);
    
            byte[] res = ctx.calculateMIC(data);
            assertArrayEquals(mic, res);
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Thu Aug 14 07:14:38 UTC 2025
    - 14.2K bytes
    - Viewed (0)
  7. src/test/java/jcifs/smb/SpnegoContextTest.java

            verify(this.mechContext, times(1)).dispose();
        }
    
        @Test
        @DisplayName("calculateMIC throws when context not established")
        void testCalculateMICRequiresEstablished() throws Exception {
            SpnegoContext ctx = newContext();
            CIFSException ex = assertThrows(CIFSException.class, () -> ctx.calculateMIC(new byte[] { 1 }));
            assertEquals("Context is not established", ex.getMessage());
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Thu Aug 14 05:31:44 UTC 2025
    - 9.3K bytes
    - Viewed (0)
  8. src/main/java/jcifs/smb/SpnegoContext.java

            return this.mechContext.isPreferredMech(mech);
        }
    
        @Override
        public byte[] calculateMIC(final byte[] data) throws CIFSException {
            if (!this.completed) {
                throw new CIFSException("Context is not established");
            }
            return this.mechContext.calculateMIC(data);
        }
    
        /**
         * {@inheritDoc}
         *
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Thu Aug 14 07:14:38 UTC 2025
    - 14.5K bytes
    - Viewed (0)
  9. src/main/java/jcifs/smb/SSPContext.java

         * @param data the data to calculate MIC for
         * @return MIC
         * @throws CIFSException if an error occurs calculating the MIC
         */
        byte[] calculateMIC(byte[] data) throws CIFSException;
    
        /**
         * Verifies a Message Integrity Code (MIC) for the given data.
         * @param data the data to verify
         * @param mic the MIC to verify against
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Sat Aug 16 01:32:48 UTC 2025
    - 3.9K bytes
    - Viewed (0)
  10. src/main/java/jcifs/smb/Kerb5Context.java

            return true;
        }
    
        /**
         * {@inheritDoc}
         *
         * @throws CIFSException
         *
         * @see jcifs.smb.SSPContext#calculateMIC(byte[])
         */
        @Override
        public byte[] calculateMIC(byte[] data) throws CIFSException {
            try {
                return this.gssContext.getMIC(data, 0, data.length, new MessageProp(false));
            } catch (GSSException e) {
    Registered: Sun Sep 07 00:10:21 UTC 2025
    - Last Modified: Thu Aug 14 07:14:38 UTC 2025
    - 13.5K bytes
    - Viewed (1)
Back to top