Tabnine Logo
EcPpk.toPk
Code IndexAdd Tabnine to your IDE (free)

How to use
toPk
method
in
com.eduworks.ec.crypto.EcPpk

Best Java code snippets using com.eduworks.ec.crypto.EcPpk.toPk (Showing top 17 results out of 315)

origin: com.eduworks/ebac.identity

  /**
   * Converts an identity to a contact.
   *
   * @return {EcContact}
   * Contact object.
   * @memberOf EcIdentity
   * @method toContact
   */
  public EcContact toContact() {
    EcContact c = new EcContact();
    c.displayName = displayName;
    c.pk = ppk.toPk();
    c.source = source;
    return c;
  }
}
origin: com.eduworks/ebac.identity

public static String myIdentitiesSearchString() {
  String searchString = "";
  for (int i = 0; i < ids.$length(); i++) {
    if (i > 0) {
      searchString += " OR ";
    }
    searchString += "@reader:\"" + ids.$get(i).ppk.toPk().toPem() + "\"";
    searchString += " OR ";
    searchString += "@owner:\"" + ids.$get(i).ppk.toPk().toPem() + "\"";
  }
  return searchString;
}
origin: com.eduworks/ebac.identity

  public static Array<EcPk> getMyPks(){
    Array<EcPk> pks = new Array<EcPk>();
    if (ids == null)
      return pks;
    for (int i = 0;i < ids.$length();i++)
      pks.push(ids.$get(i).ppk.toPk());
    return pks;
  }
}
origin: com.eduworks/ebac.identity

/**
 * Get PPK from PK (if we have it)
 *
 * @param {EcPk} fromPem PK to use to look up PPK
 * @return {EcPpk} PPK or null.
 * @memberOf EcIdentityManager
 * @method getPpk
 * @static
 */
public static EcPpk getPpk(EcPk fromPem) {
  String pem = fromPem.toPem();
  for (int i = 0; i < ids.$length(); i++) {
    if (pem.equals(ids.$get(i).ppk.toPk().toPem())) {
      return ids.$get(i).ppk;
    }
  }
  return null;
}
origin: com.eduworks/ebac.identity

/**
 * Get Identity from PK (if we have it)
 *
 * @param {EcPk} pk PK to use to look up PPK
 * @return {EcIdentity} identity or null.
 * @memberOf EcIdentityManager
 * @method getIdentity
 * @static
 */
public static EcIdentity getIdentity(EcPk pk) {
  for (int i = 0; i < ids.$length(); i++) {
    if (pk.equals(ids.$get(i).ppk.toPk())) {
      return ids.$get(i);
    }
  }
  return null;
}
origin: com.eduworks/ebac.identity

  @Override
  public void $invoke(EcIdentity p1, final Callback0 incrementalSuccess) {
    EcPpk ppk = p1.ppk;
    EcPk pk = ppk.toPk();
    boolean found = false;
    if (identityPksinPem != null) {
      for (int j = 0; j < identityPksinPem.$length(); j++) {
        EcPk ownerPpk = EcPk.fromPem(identityPksinPem.$get(j).trim());
        if (pk.equals(ownerPpk)) {
          found = true;
          createSignatureAsync(duration, server, ppk, new Callback1<EbacSignature>() {
            @Override
            public void $invoke(EbacSignature p1) {
              signatures.push(p1.atIfy());
              incrementalSuccess.$invoke();
            }
          },failure);
        }
      }
    }
    if (!found) {
      incrementalSuccess.$invoke();
    }
  }
}, new Callback1<Array<EcIdentity>>() {
origin: com.eduworks/ebac.identity

/**
 * Verifies that the contact grant is valid
 *
 * @return {boolean}
 * true if valid, false if not
 */
public boolean valid() {
  if (!verify())
    return false;
  if (invalid())
    return false;
  boolean found = false;
  for (int i = 0; i < EcIdentityManager.ids.$length(); i++) {
    if (EcRsaOaep.verify(EcIdentityManager.ids.$get(i).ppk.toPk(), responseToken, responseSignature))
      found = true;
  }
  return found;
}
origin: com.eduworks/cass.competency

/**
 * Adds a relationship between this level and a target level to define
 * how they correspond to one another
 *
 * @param {EcLevel} targetLevel
 *                  Target level of the relationship
 * @param {String}  alignmentType
 *                  Type of relationship
 * @param {EcPpk}   identity
 *                  Private key that will own the new relationship
 * @param {String}  server
 *                  URL Prefix of the new relationship ID (Server it will be saved on)
 * @memberOf EcLevel
 * @method addRelationship
 */
public void addRelationship(EcLevel targetLevel, String alignmentType, final EcPpk identity, final String serverUrl, Callback1<String> success, Callback1<String> failure, final EcRepository repo) {
  final EcAlignment a = new EcAlignment();
  a.source = id;
  a.target = targetLevel.id;
  a.relationType = alignmentType;
  a.addOwner(identity.toPk());
  if (repo == null || repo.selectedServer.indexOf(serverUrl) != -1)
    a.generateId(serverUrl);
  else
    a.generateShortId(serverUrl);
  a.signWith(identity);
  a.save(success, failure, repo);
}
origin: com.eduworks/cass.competency

l.description = description;
l.name = name;
l.addOwner(owner.toPk());
origin: com.eduworks/cass.competency

r.description = description;
r.name = name;
r.addOwner(owner.toPk());
origin: com.eduworks/ebac.identity

/**
 * Create a signature for a specific identity, authorizing movement of data
 * outside of our control.
 *
 * @param {long}   duration Length of time in milliseconds to authorize
 *                 control.
 * @param {String} server Server that we are authorizing.
 * @param {EcPpk}  ppk Key of the identity to create a signature for
 * @return {Ebac Signature} Signature created
 * @memberOf EcIdentityManager
 * @method createSignature
 * @static
 */
public static EbacSignature createSignature(long duration, String server, EcPpk ppk) {
  EbacSignature s = new EbacSignature();
  s.owner = ppk.toPk().toPem();
  s.expiry = new Date().getTime() + duration;
  s.server = server;
  s.signature = EcRsaOaep.sign(ppk, s.toJson());
  return s;
}
origin: com.eduworks/cass.competency

a.target = target.shortId();
a.relationType = alignmentType;
a.addOwner(owner.toPk());
origin: com.eduworks/ebac.identity

/**
 * Asynchronously create a signature for a specific identity
 *
 * @param {long}   duration Length of time in milliseconds to authorize
 *                 control.
 * @param {String} server Server that we are authorizing.
 * @param {EcPpk}  ppk Key of the identity to create a signature for
 * @param success  Callback triggered once the signature sheet has been
 *                 created, returns the signature
 * @memberOf EcIdentityManager
 * @method createSignatureAsync
 * @static
 */
private static void createSignatureAsync(long duration, String server, EcPpk ppk, final Callback1<EbacSignature> success, final Callback1<String> failure) {
  final EbacSignature s = new EbacSignature();
  s.owner = ppk.toPk().toPem();
  s.expiry = new Date().getTime() + duration;
  s.server = server;
  EcRsaOaepAsync.sign(ppk, s.toJson(), new Callback1<String>() {
    @Override
    public void $invoke(String p1) {
      s.signature = p1;
      success.$invoke(s);
    }
  }, failure);
}
origin: com.eduworks/ebac.identity

/**
 * Adds a contact to the identity manager. Checks for duplicates. Does not trigger
 * events.
 *
 * @param {EcContact} contact Contact to add.
 * @memberOf EcIdentityManager
 * @method addContactQuietly
 * @static
 */
public static void addContactQuietly(EcContact contact) {
  for (int i = 0; i < ids.$length(); i++) {
    if (ids.$get(i).ppk.toPk().toPem().equals(contact.pk.toPem())) {
      ids.$get(i).displayName = contact.displayName;
    }
  }
  for (int i = 0; i < contacts.$length(); i++) {
    if (contacts.$get(i).pk.toPem().equals(contact.pk.toPem())) {
      contacts.$get(i).displayName = contact.displayName;
    }
  }
  for (int i = 0; i < contacts.$length(); i++) {
    if (contacts.$get(i).equals(contact)) {
      return;
    }
  }
  contacts.push(contact);
}
origin: com.eduworks/ebac.identity

/**
 * Create a signature sheet, authorizing movement of data outside of our
 * control.
 *
 * @param {String[]} identityPksinPem Which identities to create signatures
 *                   for.
 * @param {long}     duration Length of time in milliseconds to authorize
 *                   control.
 * @param {String}   server Server that we are authorizing.
 * @return {String} JSON Array containing signatures.
 * @memberOf EcIdentityManager
 * @method signatureSheetFor
 * @static
 */
public static String signatureSheetFor(Array<String> identityPksinPem, long duration, String server) {
  Array<Object> signatures = new Array<Object>();
  for (int j = 0; j < ids.$length(); j++) {
    EcPpk ppk = ids.$get(j).ppk;
    EcPk pk = ppk.toPk();
    if (identityPksinPem != null) {
      for (int i = 0; i < identityPksinPem.$length(); i++) {
        EcPk ownerPpk = EcPk.fromPem(identityPksinPem.$get(i).trim());
        if (pk.equals(ownerPpk)) {
          signatures.push(createSignature(duration, server, ppk).atIfy());
        }
      }
    }
  }
  return JSGlobal.JSON.stringify(signatures);
}
origin: com.eduworks/ebac.identity

/**
 * Adds a contact to the identity manager. Checks for duplicates. Triggers
 * events.
 *
 * @param {EcContact} contact Contact to add.
 * @memberOf EcIdentityManager
 * @method addContact
 * @static
 */
public static void addContact(EcContact contact) {
  for (int i = 0; i < ids.$length(); i++) {
    if (ids.$get(i).ppk.toPk().toPem().equals(contact.pk.toPem())) {
      ids.$get(i).displayName = contact.displayName;
      identityChanged(ids.$get(i));
    }
  }
  for (int i = 0; i < contacts.$length(); i++) {
    if (contacts.$get(i).pk.toPem().equals(contact.pk.toPem())) {
      contacts.$get(i).displayName = contact.displayName;
      contactChanged(contacts.$get(i));
    }
  }
  for (int i = 0; i < contacts.$length(); i++) {
    if (contacts.$get(i).equals(contact)) {
      return;
    }
  }
  contacts.push(contact);
  contactChanged(contact);
}
origin: com.eduworks/ebac.repository

query += "@owner:\"" + id.ppk.toPk().toPem() + "\"";
com.eduworks.ec.cryptoEcPpktoPk

Popular methods of EcPpk

  • equals
  • fromPem
  • inArray
  • toPem

Popular in Java

  • Reading from database using SQL prepared statement
  • getSystemService (Context)
  • setContentView (Activity)
  • addToBackStack (FragmentTransaction)
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • JTextField (javax.swing)
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now