@Override public int hashCode() { int result = kvno; if (getKeyType() != null) { result = 31 * result + getKeyType().hashCode(); } if (getKeyData() != null) { result = 31 * result + Arrays.hashCode(getKeyData()); } return result; } }
@Override public int hashCode() { int result = kvno; if (getKeyType() != null) { result = 31 * result + getKeyType().hashCode(); } if (getKeyData() != null) { result = 31 * result + Arrays.hashCode(getKeyData()); } return result; } }
@Override public void writeKey(EncryptionKey key, int version) throws IOException { writeShort(key.getKeyType().getValue()); writeCountedOctets(key.getKeyData()); }
/** * Encrypt * * @param clearText The clear test * @return The cipher text. * @throws Exception e */ public byte[] encrypt(byte[] clearText, KeyUsage usage) throws Exception { // Use the secret key to encrypt/decrypt data. EncTypeHandler encType = EncryptionHandler.getEncHandler(serverKey.getKeyType()); return encType.encrypt(clearText, serverKey.getKeyData(), usage.getValue()); }
public static byte[] encrypt(EncryptionKey key, byte[] plaintext, KeyUsage usage) throws KrbException { EncTypeHandler encType = EncryptionHandler.getEncHandler(key.getKeyType()); return encType.encrypt(plaintext, key.getKeyData(), usage.getValue()); }
/** * Decrypt * * @param cipherText * @return The decrypted byte * @throws Exception e */ public byte[] decrypt(byte[] cipherText, KeyUsage usage) throws Exception { // Use the secret key to encrypt/decrypt data. EncTypeHandler encType = EncryptionHandler.getEncHandler(clientKey.getKeyType()); return encType.decrypt(cipherText, clientKey.getKeyData(), usage.getValue()); }
public static byte[] decrypt(EncryptionKey key, byte[] cipherData, KeyUsage usage) throws KrbException { EncTypeHandler encType = EncryptionHandler.getEncHandler(key.getKeyType()); return encType.decrypt(cipherData, key.getKeyData(), usage.getValue()); } }
public static byte[] decrypt(EncryptionKey key, byte[] cipherData, KeyUsage usage) throws KrbException { EncTypeHandler encType = EncryptionHandler.getEncHandler(key.getKeyType()); return encType.decrypt(cipherData, key.getKeyData(), usage.getValue()); } }
@Override public void writeKey(EncryptionKey key, int version) throws IOException { writeShort(key.getKeyType().getValue()); writeCountedOctets(key.getKeyData()); }
/** * Encrypt * * @param clearText The clear test * @return The cipher text. * @throws Exception e */ public byte[] encrypt(byte[] clearText, KeyUsage usage) throws Exception { // Use the secret key to encrypt/decrypt data. EncTypeHandler encType = EncryptionHandler.getEncHandler(serverKey.getKeyType()); return encType.encrypt(clearText, serverKey.getKeyData(), usage.getValue()); }
public static byte[] encrypt(EncryptionKey key, byte[] plaintext, KeyUsage usage) throws KrbException { EncTypeHandler encType = EncryptionHandler.getEncHandler(key.getKeyType()); return encType.encrypt(plaintext, key.getKeyData(), usage.getValue()); }
/** * Decrypt * * @param cipherText * @return The decrypted byte * @throws Exception e */ public byte[] decrypt(byte[] cipherText, KeyUsage usage) throws Exception { // Use the secret key to encrypt/decrypt data. EncTypeHandler encType = EncryptionHandler.getEncHandler(clientKey.getKeyType()); return encType.decrypt(cipherText, clientKey.getKeyData(), usage.getValue()); }
public static CheckSum makeCheckSumWithKey(CheckSumType checkSumType, byte[] input, EncryptionKey key, KeyUsage usage) throws KrbException { if (checkSumType == null || checkSumType == CheckSumType.NONE) { EncTypeHandler handler = EncryptionHandler.getEncHandler(key.getKeyType()); checkSumType = handler.checksumType(); if (checkSumType == null) { // By default, may be configured checkSumType = CheckSumType.CMAC_CAMELLIA128; } } return CheckSumHandler.checksumWithKey(checkSumType, input, key.getKeyData(), usage); }
public static CheckSum makeCheckSumWithKey(CheckSumType checkSumType, byte[] input, EncryptionKey key, KeyUsage usage) throws KrbException { if (checkSumType == null || checkSumType == CheckSumType.NONE) { EncTypeHandler handler = EncryptionHandler.getEncHandler(key.getKeyType()); checkSumType = handler.checksumType(); if (checkSumType == null) { // By default, may be configured checkSumType = CheckSumType.CMAC_CAMELLIA128; } } return CheckSumHandler.checksumWithKey(checkSumType, input, key.getKeyData(), usage); }
/** * Decrypt with the encryption key and key usage. * * @param data The encrypted data * @param key The encryption key * @param usage The key usage * @return The decrypted data * @throws KrbException e */ public static byte[] decrypt(byte[] data, EncryptionKey key, KeyUsage usage) throws KrbException { EncTypeHandler handler = getEncHandler(key.getKeyType()); return handler.decrypt(data, key.getKeyData(), usage.getValue()); }
public byte[] decryptData(byte[] dataEncrypted, int keyUsage) throws GSSException { byte[] ret; try { EncTypeHandler encHandler = EncryptionHandler.getEncHandler(encKey.getKeyType()); ret = encHandler.decrypt(dataEncrypted, encKey.getKeyData(), keyUsage); } catch (KrbException e) { throw new GSSException(GSSException.FAILURE, -1, e.getMessage()); } return ret; }
public byte[] encryptData(byte[] toProcess, int keyUsage) throws GSSException { byte[] ret; try { EncTypeHandler encHandler = EncryptionHandler.getEncHandler(encKey.getKeyType()); ret = encHandler.encrypt(toProcess, encKey.getKeyData(), keyUsage); } catch (KrbException e) { throw new GSSException(GSSException.FAILURE, -1, e.getMessage()); } return ret; }
/** * Decrypt with the encryption key and key usage. * * @param data The encrypted data * @param key The encryption key * @param usage The key usage * @return The decrypted data * @throws KrbException e */ public static byte[] decrypt(EncryptedData data, EncryptionKey key, KeyUsage usage) throws KrbException { EncTypeHandler handler = getEncHandler(key.getKeyType()); return handler.decrypt(data.getCipher(), key.getKeyData(), usage.getValue()); }
@Override public void writeKey(EncryptionKey key, int version) throws IOException { writeShort(key.getKeyType().getValue()); if (version == CredentialCache.FCC_FVNO_3) { writeShort(key.getKeyType().getValue()); } writeCountedOctets(key.getKeyData()); }
@Override public void writeKey(EncryptionKey key, int version) throws IOException { writeShort(key.getKeyType().getValue()); if (version == CredentialCache.FCC_FVNO_3) { writeShort(key.getKeyType().getValue()); } writeCountedOctets(key.getKeyData()); }