Пример #1
0
  /**
   * Checks if an XDI attribute is a valid XDI signature.
   *
   * @param xdiAttribute The XDI attribute to check.
   * @return True if the XDI attribute is a valid XDI signature.
   */
  public static boolean isValid(XdiAttribute xdiAttribute) {

    if (xdiAttribute == null) return false;

    return RSASignature.isValid(xdiAttribute)
        || AESSignature.isValid(xdiAttribute)
        || EC25519Signature.isValid(xdiAttribute);
  }
Пример #2
0
  /**
   * Factory method that creates an XDI signature bound to a given XDI attribute.
   *
   * @param xdiAttribute The XDI signature that is an XDI signature.
   * @return The XDI signature.
   */
  public static Signature fromXdiAttribute(XdiAttribute xdiAttribute) {

    Signature signature;

    if ((signature = RSASignature.fromXdiAttribute(xdiAttribute)) != null) return signature;
    if ((signature = AESSignature.fromXdiAttribute(xdiAttribute)) != null) return signature;
    if ((signature = EC25519Signature.fromXdiAttribute(xdiAttribute)) != null) return signature;

    return null;
  }