/** * @see Object#equals(Object) */ @Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof CheckSum)) { return false; } CheckSum that = (CheckSum) other; return getCksumtype() == that.getCksumtype() && Arrays.equals(getChecksum(), that.getChecksum()); }
public static CheckSum checksum(CheckSumType checkSumType, byte[] bytes) throws KrbException { CheckSumTypeHandler handler = getCheckSumHandler(checkSumType); byte[] checksumBytes = handler.checksum(bytes); CheckSum checkSum = new CheckSum(); checkSum.setCksumtype(checkSumType); checkSum.setChecksum(checksumBytes); return checkSum; }
/** * @param other The checksum to be compared * @return <tt>true</tt> if the given Checksum is equal to the instance */ public boolean isEqual(CheckSum other) { return this.equals(other); }
/** * Creates a new initialized instance of Checksum * * @param cksumType The {@link CheckSumType} * @param checksum The checksum as a byte[] */ public CheckSum(CheckSumType cksumType, byte[] checksum) { super(fieldInfos); setCksumtype(cksumType); setChecksum(checksum); }
if (expectedCheckSum.getChecksum().length != receivedCheckSumByte.length || !Arrays.equals(expectedCheckSum.getChecksum(), receivedCheckSumByte)) { LOG.debug("received checksum length: " + receivedCheckSumByte.length + ", expected checksum type: " + expectedCheckSum.getCksumtype() + ", expected checksum length: " + expectedCheckSum.encodingLength()); String errorMessage = "Failed to match the checksum."; LOG.error(errorMessage);
/** * Compare the checksum value of a given Checksum instance and this instance. * * @param cksumBytes The checksum bytes to be compared * @return <tt>true</tt> if the given CheckSum's checksum is equal to the instance's checksum */ public boolean isEqual(byte[] cksumBytes) { return Arrays.equals(getChecksum(), cksumBytes); } }
switch (checkSum.getCksumtype()) { case RSA_MD5_DES: case RSA_MD4_DES:
if (expectedCheckSum.getChecksum().length != receivedCheckSumByte.length || !Arrays.equals(expectedCheckSum.getChecksum(), receivedCheckSumByte)) { LOG.debug("received checksum length: " + receivedCheckSumByte.length + ", expected checksum type: " + expectedCheckSum.getCksumtype() + ", expected checksum length: " + expectedCheckSum.encodingLength()); String errorMessage = "Failed to match the checksum."; LOG.error(errorMessage);
/** * Compare the checksum value of a given Checksum instance and this instance. * * @param cksumBytes The checksum bytes to be compared * @return <tt>true</tt> if the given CheckSum's checksum is equal to the instance's checksum */ public boolean isEqual(byte[] cksumBytes) { return Arrays.equals(getChecksum(), cksumBytes); } }
/** * Creates a new initialized instance of Checksum * * @param cksumType The {@link CheckSumType} * @param checksum The checksum as a byte[] */ public CheckSum(CheckSumType cksumType, byte[] checksum) { super(fieldInfos); setCksumtype(cksumType); setChecksum(checksum); }
switch (checkSum.getCksumtype()) { case RSA_MD5_DES: case RSA_MD4_DES:
/** * @see Object#equals(Object) */ @Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof CheckSum)) { return false; } CheckSum that = (CheckSum) other; return getCksumtype() == that.getCksumtype() && Arrays.equals(getChecksum(), that.getChecksum()); }
public static CheckSum checksum(CheckSumType checkSumType, byte[] bytes) throws KrbException { CheckSumTypeHandler handler = getCheckSumHandler(checkSumType); byte[] checksumBytes = handler.checksum(bytes); CheckSum checkSum = new CheckSum(); checkSum.setCksumtype(checkSumType); checkSum.setChecksum(checksumBytes); return checkSum; }
pkAuthen.setCtime(ctime); pkAuthen.setNonce(nonce); pkAuthen.setPaChecksum(checkSum.getChecksum()); authPack.setPkAuthenticator(pkAuthen); authPack.setsupportedCmsTypes(pkinitContext.getPluginOpts().createSupportedCMSTypes());
/** * @param other The checksum to be compared * @return <tt>true</tt> if the given Checksum is equal to the instance */ public boolean isEqual(CheckSum other) { return this.equals(other); }
/** * @see Object#hashCode() */ @Override public int hashCode() { int result = 17; if (getCksumtype() != null) { result = 31 * result + getCksumtype().hashCode(); } if (getChecksum() != null) { result = 31 * result + Arrays.hashCode(getChecksum()); } return result; }
public static CheckSum checksumWithKey(CheckSumType checkSumType, byte[] bytes, byte[] key, KeyUsage usage) throws KrbException { CheckSumTypeHandler handler = getCheckSumHandler(checkSumType); byte[] checksumBytes = handler.checksumWithKey(bytes, key, usage.getValue()); CheckSum checkSum = new CheckSum(); checkSum.setCksumtype(checkSumType); checkSum.setChecksum(checksumBytes); return checkSum; }
pkAuthen.setCtime(ctime); pkAuthen.setNonce(nonce); pkAuthen.setPaChecksum(checkSum.getChecksum()); authPack.setPkAuthenticator(pkAuthen); authPack.setsupportedCmsTypes(pkinitContext.getPluginOpts().createSupportedCMSTypes());
/** * @see Object#hashCode() */ @Override public int hashCode() { int result = 17; if (getCksumtype() != null) { result = 31 * result + getCksumtype().hashCode(); } if (getChecksum() != null) { result = 31 * result + Arrays.hashCode(getChecksum()); } return result; }
public static CheckSum checksumWithKey(CheckSumType checkSumType, byte[] bytes, byte[] key, KeyUsage usage) throws KrbException { CheckSumTypeHandler handler = getCheckSumHandler(checkSumType); byte[] checksumBytes = handler.checksumWithKey(bytes, key, usage.getValue()); CheckSum checkSum = new CheckSum(); checkSum.setCksumtype(checkSumType); checkSum.setChecksum(checksumBytes); return checkSum; }