sun.security.mule.krb5.internal.crypto
Class Des

java.lang.Object
  extended by sun.security.mule.krb5.internal.crypto.Des

public final class Des
extends Object


Constructor Summary
Des()
           
 
Method Summary
static boolean bad_key(byte[] key)
           
static boolean bad_key(long key)
           
static void cbc_encrypt(byte[] input, byte[] output, byte[] key, byte[] ivec, boolean encrypt)
          Creates a DES cipher in Electronic Codebook mode, with no padding.
static long char_to_key(char[] passwdChars)
          Generates DES key from the password.
static byte[] des_cksum(byte[] ivec, byte[] msg, byte[] key)
          Encrypts the message blocks using DES CBC and output the final block of 8-byte ciphertext.
static byte[] long2octet(long input)
           
static void long2octet(long input, byte[] output)
           
static void long2octet(long input, byte[] output, int offset)
           
static long octet2long(byte[] input)
           
static long octet2long(byte[] input, int offset)
           
static byte[] set_parity(byte[] key)
           
static long set_parity(long key)
           
static byte[] string_to_key_bytes(char[] passwdChars)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Des

public Des()
Method Detail

set_parity

public static final byte[] set_parity(byte[] key)

set_parity

public static final long set_parity(long key)

bad_key

public static final boolean bad_key(long key)

bad_key

public static final boolean bad_key(byte[] key)

octet2long

public static long octet2long(byte[] input)

octet2long

public static long octet2long(byte[] input,
                              int offset)

long2octet

public static byte[] long2octet(long input)

long2octet

public static void long2octet(long input,
                              byte[] output)

long2octet

public static void long2octet(long input,
                              byte[] output,
                              int offset)

cbc_encrypt

public static void cbc_encrypt(byte[] input,
                               byte[] output,
                               byte[] key,
                               byte[] ivec,
                               boolean encrypt)
                        throws KrbCryptoException
Creates a DES cipher in Electronic Codebook mode, with no padding.

Parameters:
input - plain text.
output - the buffer for the result.
key - DES the key to encrypt the text.
ivec - initialization vector.
Throws:
KrbCryptoException

char_to_key

public static long char_to_key(char[] passwdChars)
                        throws KrbCryptoException
Generates DES key from the password.

Parameters:
password - a char[] used to create the key.
Returns:
DES key.
Throws:
KrbCryptoException

des_cksum

public static byte[] des_cksum(byte[] ivec,
                               byte[] msg,
                               byte[] key)
                        throws KrbCryptoException
Encrypts the message blocks using DES CBC and output the final block of 8-byte ciphertext.

Parameters:
ivec - Initialization vector.
msg - Input message as an byte array.
key - DES key to encrypt the message.
Returns:
the last block of ciphertext.
Throws:
KrbCryptoException

string_to_key_bytes

public static byte[] string_to_key_bytes(char[] passwdChars)
                                  throws KrbCryptoException
Throws:
KrbCryptoException


Copyright © 2013. All Rights Reserved.