/** * Get a byte iterator for a byte array. * * @param bytes the array * @return the byte iterator */ public static ByteIterator ofBytes(final byte... bytes) { return ofBytes(bytes, 0, bytes.length); }
/** * Get a byte iterator for a byte array with interleave. * * @param bytes the array * @param interleave the interleave table to use * @return the byte iterator */ public static ByteIterator ofBytes(final byte[] bytes, final int[] interleave) { return ofBytes(bytes, 0, bytes.length, interleave); }
public ByteIterator sign(Signature signature) throws IllegalStateException { update(signature); try { return ByteIterator.ofBytes(signature.sign()); } catch (SignatureException e) { throw new IllegalStateException(e); } }
public ByteIterator doFinal(final MessageDigest digest) throws IllegalStateException { update(digest); return ByteIterator.ofBytes(digest.digest()); }
public ByteIterator doFinal(final Mac mac) throws IllegalStateException { update(mac); return ByteIterator.ofBytes(mac.doFinal()); }
public ByteIterator doFinal(MessageDigest digest) throws IllegalStateException { update(digest); return ByteIterator.ofBytes(digest.digest()); }
/** * Get a code point iterator for a UTF-8 encoded array. * * @param bytes the array * @param offs the array offset * @param len the number of characters to include * @return the code point iterator */ public static CodePointIterator ofUtf8Bytes(final byte[] bytes, final int offs, final int len) { if (len <= 0) { return EMPTY; } return ByteIterator.ofBytes(bytes, offs, len).asUtf8String(); }
/** * Get a code point iterator for a ISO-8859-1 (Latin-1) encoded array. * * @param bytes the array * @param offs the array offset * @param len the number of characters to include * @return the code point iterator */ public static CodePointIterator ofLatin1Bytes(final byte[] bytes, final int offs, final int len) { if (len <= 0) { return EMPTY; } return ByteIterator.ofBytes(bytes, offs, len).asLatin1String(); }
public ByteIterator doFinal(Mac mac) throws IllegalStateException { return ByteIterator.ofBytes(mac.doFinal(drain())); }
@Override public boolean verifyCertificate(X509Certificate certificate, Attributes attributes) throws NamingException, RealmUnavailableException { Attribute attribute = attributes.get(ldapAttribute); if (attribute == null) return false; final int size = attribute.size(); try { MessageDigest md = MessageDigest.getInstance(algorithm); String digest = ByteIterator.ofBytes(md.digest(certificate.getEncoded())).hexEncode(true).drainToString(); for (int i = 0; i < size; i++) { Object attrDigest = attribute.get(i); if (attrDigest != null){ if (digest.equalsIgnoreCase((String) attrDigest)) { return true; } } } } catch (NoSuchAlgorithmException | CertificateEncodingException e) { throw new RealmUnavailableException(e); } return false; } }
/** * Get a byte iterator for a byte array. * * @param bytes the array * @return the byte iterator */ public static ByteIterator ofBytes(final byte... bytes) { return ofBytes(bytes, 0, bytes.length); }
/** * Get a byte iterator for a byte array. * * @param bytes the array * @return the byte iterator */ public static ByteIterator ofBytes(final byte... bytes) { return ofBytes(bytes, 0, bytes.length); }
/** * Get a byte iterator for a byte array with interleave. * * @param bytes the array * @param interleave the interleave table to use * @return the byte iterator */ public static ByteIterator ofBytes(final byte[] bytes, final int[] interleave) { return ofBytes(bytes, 0, bytes.length, interleave); }
/** * Get a byte iterator for a byte array with interleave. * * @param bytes the array * @param interleave the interleave table to use * @return the byte iterator */ public static ByteIterator ofBytes(final byte[] bytes, final int[] interleave) { return ofBytes(bytes, 0, bytes.length, interleave); }
public ByteIterator sign(Signature signature) throws IllegalStateException { update(signature); try { return ByteIterator.ofBytes(signature.sign()); } catch (SignatureException e) { throw new IllegalStateException(e); } }
public ByteIterator sign(Signature signature) throws IllegalStateException { update(signature); try { return ByteIterator.ofBytes(signature.sign()); } catch (SignatureException e) { throw new IllegalStateException(e); } }
public ByteIterator doFinal(final MessageDigest digest) throws IllegalStateException { update(digest); return ByteIterator.ofBytes(digest.digest()); }
public ByteIterator doFinal(MessageDigest digest) throws IllegalStateException { update(digest); return ByteIterator.ofBytes(digest.digest()); }
public ByteIterator doFinal(final Mac mac) throws IllegalStateException { update(mac); return ByteIterator.ofBytes(mac.doFinal()); }
public ByteIterator doFinal(final MessageDigest digest) throws IllegalStateException { update(digest); return ByteIterator.ofBytes(digest.digest()); }