default IteratedSaltedPasswordAlgorithmSpec getParameterSpec() { final int salt = getSalt(); byte[] saltBytes = new byte[4]; // Big-endian format saltBytes[0] = (byte) (salt >>> 24 & 0xff); saltBytes[1] = (byte) (salt >>> 16 & 0xff); saltBytes[2] = (byte) (salt >>> 8 & 0xff); saltBytes[3] = (byte) (salt & 0xff); return new IteratedSaltedPasswordAlgorithmSpec(getIterationCount(), saltBytes); }
ScramDigestPasswordImpl(final String algorithm, final char[] password, final IteratedSaltedPasswordAlgorithmSpec spec) throws InvalidKeySpecException, NoSuchAlgorithmException, InvalidKeyException { this(algorithm, password, spec.getSalt(), spec.getIterationCount()); }
MaskedPasswordImpl(final String algorithm, final char[] clearPassword, final IteratedSaltedPasswordAlgorithmSpec parameterSpec) throws InvalidKeySpecException { this(algorithm, DEFAULT_PBE_KEY, parameterSpec.getIterationCount(), parameterSpec.getSalt().clone(), clearPassword); }
default IteratedSaltedPasswordAlgorithmSpec getParameterSpec() { return new IteratedSaltedPasswordAlgorithmSpec(getIterationCount(), getSalt()); }
SunUnixMD5CryptPasswordImpl(final String algorithm, final char[] password, final IteratedSaltedPasswordAlgorithmSpec spec) throws NoSuchAlgorithmException { this(algorithm, password, spec.getSalt().clone(), spec.getIterationCount()); }
default IteratedSaltedPasswordAlgorithmSpec getParameterSpec() { return new IteratedSaltedPasswordAlgorithmSpec(getIterationCount(), getSalt()); }
BSDUnixDESCryptPasswordImpl(final char[] password, final IteratedSaltedPasswordAlgorithmSpec spec) throws InvalidKeySpecException, InvalidParameterSpecException { this(password, getSaltValue(spec.getSalt()), spec.getIterationCount()); }
default IteratedSaltedPasswordAlgorithmSpec getParameterSpec() { return new IteratedSaltedPasswordAlgorithmSpec(getIterationCount(), getSalt()); }
BCryptPasswordImpl(final char[] password, final IteratedSaltedPasswordAlgorithmSpec spec) throws InvalidKeySpecException { this.salt = spec.getSalt().clone(); this.iterationCount = spec.getIterationCount(); this.hash = bcrypt(this.iterationCount, this.salt, getNormalizedPasswordBytes(password)); }
default IteratedSaltedPasswordAlgorithmSpec getParameterSpec() { return new IteratedSaltedPasswordAlgorithmSpec(getIterationCount(), getSalt()); }
default boolean impliesParameters(AlgorithmParameterSpec parameterSpec) { Assert.checkNotNullParam("parameterSpec", parameterSpec); if (parameterSpec instanceof IteratedSaltedPasswordAlgorithmSpec) { final IteratedSaltedPasswordAlgorithmSpec spec = (IteratedSaltedPasswordAlgorithmSpec) parameterSpec; return getIterationCount() <= spec.getIterationCount() && Arrays.equals(getParameterSpec().getSalt(), spec.getSalt()); } else if (parameterSpec instanceof SaltedPasswordAlgorithmSpec) { return Arrays.equals(getParameterSpec().getSalt(), ((SaltedPasswordAlgorithmSpec) parameterSpec).getSalt()); } else if (parameterSpec instanceof IteratedPasswordAlgorithmSpec) { return getIterationCount() <= ((IteratedPasswordAlgorithmSpec) parameterSpec).getIterationCount(); } else { return false; } }
protected IteratedSaltedPasswordAlgorithmSpec engineDecode(final ASN1Decoder decoder) { decoder.startSequence(); final int iterationCount = decoder.decodeInteger().intValue(); final byte[] salt = decoder.decodeOctetString(); decoder.endSequence(); return new IteratedSaltedPasswordAlgorithmSpec(iterationCount, salt); } }
protected void engineEncode(final ASN1Encoder encoder, final IteratedSaltedPasswordAlgorithmSpec parameterSpec) { encoder.startSequence(); encoder.encodeInteger(parameterSpec.getIterationCount()); encoder.encodeOctetString(parameterSpec.getSalt()); encoder.endSequence(); }
final IteratedSaltedPasswordAlgorithmSpec parameters = new IteratedSaltedPasswordAlgorithmSpec( initialChallenge.getIterationCount(), initialChallenge.getRawSalt()
default boolean impliesParameters(AlgorithmParameterSpec parameterSpec) { Assert.checkNotNullParam("parameterSpec", parameterSpec); if (parameterSpec instanceof IteratedSaltedPasswordAlgorithmSpec) { final IteratedSaltedPasswordAlgorithmSpec spec = (IteratedSaltedPasswordAlgorithmSpec) parameterSpec; // iteration count has to match exactly since it's not flexible for this algorithm return ITERATION_COUNT == spec.getIterationCount() && Arrays.equals(getSalt(), spec.getSalt()); } else if (parameterSpec instanceof SaltedPasswordAlgorithmSpec) { return Arrays.equals(getSalt(), ((SaltedPasswordAlgorithmSpec) parameterSpec).getSalt()); } else if (parameterSpec instanceof IteratedPasswordAlgorithmSpec) { // iteration count has to match exactly since it's not flexible for this algorithm return ITERATION_COUNT == ((IteratedPasswordAlgorithmSpec) parameterSpec).getIterationCount(); } else { return false; } }
default IteratedSaltedPasswordAlgorithmSpec getParameterSpec() { final int salt = getSalt(); byte[] saltBytes = new byte[4]; // Big-endian format saltBytes[0] = (byte) (salt >>> 24 & 0xff); saltBytes[1] = (byte) (salt >>> 16 & 0xff); saltBytes[2] = (byte) (salt >>> 8 & 0xff); saltBytes[3] = (byte) (salt & 0xff); return new IteratedSaltedPasswordAlgorithmSpec(getIterationCount(), saltBytes); }
default boolean impliesParameters(AlgorithmParameterSpec parameterSpec) { Assert.checkNotNullParam("parameterSpec", parameterSpec); if (parameterSpec instanceof IteratedSaltedPasswordAlgorithmSpec) { final IteratedSaltedPasswordAlgorithmSpec spec = (IteratedSaltedPasswordAlgorithmSpec) parameterSpec; return getIterationCount() <= spec.getIterationCount() && Arrays.equals(getSalt(), spec.getSalt()); } else if (parameterSpec instanceof SaltedPasswordAlgorithmSpec) { return Arrays.equals(getSalt(), ((SaltedPasswordAlgorithmSpec) parameterSpec).getSalt()); } else if (parameterSpec instanceof IteratedPasswordAlgorithmSpec) { return getIterationCount() <= ((IteratedPasswordAlgorithmSpec) parameterSpec).getIterationCount(); } else { return false; } }
default IteratedSaltedPasswordAlgorithmSpec getParameterSpec() { final int salt = getSalt(); byte[] saltBytes = new byte[4]; // Big-endian format saltBytes[0] = (byte) (salt >>> 24 & 0xff); saltBytes[1] = (byte) (salt >>> 16 & 0xff); saltBytes[2] = (byte) (salt >>> 8 & 0xff); saltBytes[3] = (byte) (salt & 0xff); return new IteratedSaltedPasswordAlgorithmSpec(getIterationCount(), saltBytes); }
default boolean impliesParameters(AlgorithmParameterSpec parameterSpec) { Assert.checkNotNullParam("parameterSpec", parameterSpec); if (parameterSpec instanceof IteratedSaltedPasswordAlgorithmSpec) { final IteratedSaltedPasswordAlgorithmSpec spec = (IteratedSaltedPasswordAlgorithmSpec) parameterSpec; return getIterationCount() <= spec.getIterationCount() && Arrays.equals(getSalt(), spec.getSalt()); } else if (parameterSpec instanceof SaltedPasswordAlgorithmSpec) { return Arrays.equals(getSalt(), ((SaltedPasswordAlgorithmSpec) parameterSpec).getSalt()); } else if (parameterSpec instanceof IteratedPasswordAlgorithmSpec) { return getIterationCount() <= ((IteratedPasswordAlgorithmSpec) parameterSpec).getIterationCount(); } else { return false; } }
default IteratedSaltedPasswordAlgorithmSpec getParameterSpec() { final int salt = getSalt(); byte[] saltBytes = new byte[4]; // Big-endian format saltBytes[0] = (byte) (salt >>> 24 & 0xff); saltBytes[1] = (byte) (salt >>> 16 & 0xff); saltBytes[2] = (byte) (salt >>> 8 & 0xff); saltBytes[3] = (byte) (salt & 0xff); return new IteratedSaltedPasswordAlgorithmSpec(getIterationCount(), saltBytes); }