Package javax.security.auth.kerberos

Examples of javax.security.auth.kerberos.KerberosKey


     * @throws Exception
     */
    @Test
    public void testPlainTextSizeLessThanBlockSize() throws Exception
    {
        KerberosKey key = new KerberosKey( new KerberosPrincipal( "hnelson@EXAMPLE.COM" ), PASSWORD, "DES" );
        byte[] keyBytes = key.getEncoded();
        EncryptionKey encryptionKey = new EncryptionKey( EncryptionType.DES_CBC_MD5, keyBytes );

        byte[] plainText =
            { 1, 2, 3, 4, 5, 6, 7 };

View Full Code Here


     * @throws Exception
     */
    @Test
    public void testPlainTextSizeEqualsBlockSize() throws Exception
    {
        KerberosKey key = new KerberosKey( new KerberosPrincipal( "hnelson@EXAMPLE.COM" ), PASSWORD, "DES" );
        byte[] keyBytes = key.getEncoded();
        EncryptionKey encryptionKey = new EncryptionKey( EncryptionType.DES_CBC_MD5, keyBytes );

        byte[] plainText =
            { 1, 2, 3, 4, 5, 6, 7, 8 };

View Full Code Here

     * @throws Exception
     */
    @Test
    public void testPlainTextSizeGreaterThanBlockSize() throws Exception
    {
        KerberosKey key = new KerberosKey( new KerberosPrincipal( "hnelson@EXAMPLE.COM" ), PASSWORD, "DES" );
        byte[] keyBytes = key.getEncoded();
        EncryptionKey encryptionKey = new EncryptionKey( EncryptionType.DES_CBC_MD5, keyBytes );

        byte[] plainText =
            { 1, 2, 3, 4, 5, 6, 7, 8, 9 };

View Full Code Here

                ( byte ) 0x3E, ( byte ) 0x3B, ( byte ) 0xFE, ( byte ) 0xF7, ( byte ) 0x51, ( byte ) 0x19,
                ( byte ) 0x37, ( byte ) 0xDC, ( byte ) 0xF7, ( byte ) 0x2C, ( byte ) 0x3E };

        KerberosPrincipal principal = new KerberosPrincipal( "raeburn@ATHENA.MIT.EDU" );
        String algorithm = VendorHelper.getTripleDesAlgorithm();
        KerberosKey key = new KerberosKey( principal, "password".toCharArray(), algorithm );

        assertEquals( "DESede key length", 24, key.getEncoded().length );
        assertTrue( "Key match", Arrays.equals( expectedKey, key.getEncoded() ) );
    }
View Full Code Here

                ( byte ) 0x15, ( byte ) 0xE0, ( byte ) 0x61, ( byte ) 0xB0, ( byte ) 0x29, ( byte ) 0x79,
                ( byte ) 0xC1, ( byte ) 0xF7, ( byte ) 0x4F, ( byte ) 0x37, ( byte ) 0x7A };

        KerberosPrincipal principal = new KerberosPrincipal( "danny@WHITEHOUSE.GOV" );
        String algorithm = VendorHelper.getTripleDesAlgorithm();
        KerberosKey key = new KerberosKey( principal, "potatoe".toCharArray(), algorithm );

        assertEquals( "DESede key length", 24, key.getEncoded().length );
        assertTrue( "Key match", Arrays.equals( expectedKey, key.getEncoded() ) );
    }
View Full Code Here

                ( byte ) 0x10, ( byte ) 0xA2, ( byte ) 0x34, ( byte ) 0x89, ( byte ) 0xB0, ( byte ) 0xD3,
                ( byte ) 0xB6, ( byte ) 0x9D, ( byte ) 0x5D, ( byte ) 0x9D, ( byte ) 0x4A };

        KerberosPrincipal principal = new KerberosPrincipal( "buckaroo@EXAMPLE.COM" );
        String algorithm = VendorHelper.getTripleDesAlgorithm();
        KerberosKey key = new KerberosKey( principal, "penny".toCharArray(), algorithm );

        assertEquals( "DESede key length", 24, key.getEncoded().length );
        assertTrue( "Key match", Arrays.equals( expectedKey, key.getEncoded() ) );
    }
View Full Code Here

                ( byte ) 0x70, ( byte ) 0x32, ( byte ) 0x4C, ( byte ) 0x83, ( byte ) 0x19, ( byte ) 0x73,
                ( byte ) 0xA7, ( byte ) 0xB9, ( byte ) 0x52, ( byte ) 0xFE, ( byte ) 0xB0 };

        KerberosPrincipal principal = new KerberosPrincipal( "Juri\u0161i\u0107@ATHENA.MIT.EDU" );
        String algorithm = VendorHelper.getTripleDesAlgorithm();
        KerberosKey key = new KerberosKey( principal, "\u00DF".toCharArray(), algorithm );

        assertEquals( "DESede key length", 24, key.getEncoded().length );
        assertTrue( "Key match", Arrays.equals( expectedKey, key.getEncoded() ) );
    }
View Full Code Here

                ( byte ) 0x75, ( byte ) 0x1F, ( byte ) 0x07, ( byte ) 0xF1, ( byte ) 0xC4, ( byte ) 0xCB,
                ( byte ) 0xB0, ( byte ) 0x98, ( byte ) 0xF4, ( byte ) 0x0B, ( byte ) 0x19 };

        KerberosPrincipal principal = new KerberosPrincipal( "pianist@EXAMPLE.COM" );
        String algorithm = VendorHelper.getTripleDesAlgorithm();
        KerberosKey key = new KerberosKey( principal, "\uD834\uDD1E".toCharArray(), algorithm );

        assertEquals( "DESede key length", 24, key.getEncoded().length );
        assertTrue( "Key match", Arrays.equals( expectedKey, key.getEncoded() ) );
    }
View Full Code Here

            EncryptionType encryptionType = it.next();
            String algorithm = DEFAULT_CIPHERS.get( encryptionType );

            try
            {
                KerberosKey kerberosKey = new KerberosKey( principal, passPhrase.toCharArray(), algorithm );
                EncryptionKey encryptionKey = new EncryptionKey( encryptionType, kerberosKey.getEncoded(), kerberosKey
                    .getVersionNumber() );

                kerberosKeys.put( encryptionType, encryptionKey );
            }
            catch ( IllegalArgumentException iae )
View Full Code Here

     * @param serverPassword
     * @return The server's {@link EncryptionKey}.
     */
    public EncryptionKey getServerKey( KerberosPrincipal serverPrincipal, String serverPassword )
    {
        KerberosKey serverKerberosKey = new KerberosKey( serverPrincipal, serverPassword.toCharArray(), "DES" );
        byte[] serverKeyBytes = serverKerberosKey.getEncoded();
        EncryptionKey serverKey = new EncryptionKey( EncryptionType.DES_CBC_MD5, serverKeyBytes );

        return serverKey;
    }
View Full Code Here

TOP

Related Classes of javax.security.auth.kerberos.KerberosKey

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.