Module jcifs

Class Crypto

java.lang.Object
org.codelibs.jcifs.smb.util.Crypto

public final class Crypto extends Object
Cryptographic utility class providing encryption and decryption functionality for jCIFS. Handles security provider initialization and cryptographic operations for SMB authentication.
Author:
mbechler
  • Method Details

    • getMD4

      public static MessageDigest getMD4()
      Get an MD4 message digest instance.
      Returns:
      MD4 digest instance
    • getMD5

      public static MessageDigest getMD5()
      Get an MD5 message digest instance.
      Returns:
      MD5 digest instance
    • getSHA512

      public static MessageDigest getSHA512()
      Get a SHA-512 message digest instance.
      Returns:
      SHA512 digest instance
    • getHMACT64

      public static MessageDigest getHMACT64(byte[] key)
      Get an HMACT64 message authentication code instance.
      Parameters:
      key - the key for the HMACT64 MAC
      Returns:
      HMACT64 MAC instance
    • getArcfour

      public static Cipher getArcfour(byte[] key)
      Get an RC4 cipher instance initialized with the specified key.
      Parameters:
      key - the encryption key
      Returns:
      RC4 cipher in encryption mode
    • getDES

      public static Cipher getDES(byte[] key)
      Get a DES cipher in encryption mode
      Parameters:
      key - 7 or 8 byte DES key
      Returns:
      DES cipher in encryption mode
    • getProvider

      public static Provider getProvider()
      Default provider is BouncyCastleProvider. For registering custom provider
      Returns:
      Provider
      See Also:
    • initProvider

      public static void initProvider(Provider customProvider) throws CIFSUnsupportedCryptoException
      Initialize Provider Instance with customProvider
      Parameters:
      customProvider - the custom cryptographic provider to use
      Throws:
      CIFSUnsupportedCryptoException - if Provider has already been initialized.