Package java.security

Examples of java.security.PublicKey


            List list = keyInfo.getContent();

            for (int i = 0; i < list.size(); i++) {
                XMLStructure xmlStructure = (XMLStructure) list.get(i);
                if (xmlStructure instanceof KeyValue) {
                    PublicKey pk = null;
                    try {
                        pk = ((KeyValue) xmlStructure).getPublicKey();
                    } catch (KeyException ke) {
                        throw new KeySelectorException(ke);
                    }
                    // make sure algorithm is compatible with method
                    if (algEquals(sm.getAlgorithm(), pk.getAlgorithm())) {
                        return new SimpleKeySelectorResult(pk);
                    }
                }
            }
            throw new KeySelectorException("No KeyValue element found!");
View Full Code Here


    if (trustKeys == null) {
      CertificateAndKey certificateAndKey = encryptionStore.getCertificateAndKey("https");

      List<String> trustKeys = Lists.newArrayList();
      for (X509Certificate certificate : certificateAndKey.getCertificateChain()) {
        PublicKey publicKey = certificate.getPublicKey();
        trustKeys.add(OpenSshUtils.getSignatureString(publicKey));
      }
      this.trustKeys = Optional.of(trustKeys);
    }
    return trustKeys.orNull();
View Full Code Here

  }

  private void addDirectStore(ImageStore model) throws OpsException {
    // Serious bootstrapping problem here!!!
    SshKey serviceKey = service.getSshKey();
    PublicKey sshPublicKey = serviceKey.getKeyPair().getPublic();

    OpaqueMachine machine = new OpaqueMachine(NetworkPoint.forPublicHostname(model.dnsName));
    OpsTarget target = machine.getTarget("imagestore", serviceKey.getKeyPair());

    SshAuthorizedKey.ensureSshAuthorization(target, "imagestore", sshPublicKey);
View Full Code Here

  public static PublicKey deserializePublicKey(byte[] keyData) {
    X509EncodedKeySpec pubKeySpec = new X509EncodedKeySpec(keyData);

    KeyFactory keyFactory = getKeyFactory();

    PublicKey pubKey;
    try {
      pubKey = keyFactory.generatePublic(pubKeySpec);
    } catch (InvalidKeySpecException e) {
      throw new IllegalArgumentException("Error deserializing public key", e);
    }
View Full Code Here

        throw new RepositoryException("Project not found");
      }

      byte[] projectSecretData = FathomdbCrypto.serialize(projectSecret);

      PublicKey userPublicKey = user.getPublicKey();

      byte[] newSecretData;
      try {
        SecretStore store = new SecretStore(project.secretData);
        Writer writer = store.buildWriter();
View Full Code Here

        throw new RepositoryException("Project not found");
      }

      byte[] projectSecretData = onProjectSecret.getEncoded();

      PublicKey grantToProjectPublicKey = grantToProject.getPublicKey();

      byte[] newSecretData;
      try {
        SecretStore store = new SecretStore(onProject.secretData);
        Writer writer = store.buildWriter();
View Full Code Here

        }

        // For certificate auth
        if (certificateChain != null) {
          Certificate certificate = certificateChain[0];
          PublicKey publicKey = certificate.getPublicKey();

          publicKeyHash = OpenSshUtils.getSignature(publicKey).toByteArray();

          writer.writeGenericAsymetricKey(userSecret, publicKey);
        }
View Full Code Here

    SshKey sshKey = serviceContext.getSshKey();
    if (sshKey == null) {
      return null;
    }
    PublicKey publicKey = sshKey.getKeyPair().getPublic();
    return publicKey;
  }
View Full Code Here

    }

    log.warn("Using (deprecated) system keys");

    for (File file : dir.listFiles(new FilenameEndsWithFilter(".pub"))) {
      PublicKey publicKey = RsaUtils.loadPublicKey(file);
      String name = file.getName();
      name = name.replace(".pub", "");
      publicKeys.put(Integer.parseInt(name), publicKey);
    }
View Full Code Here

      SecretStore.Writer writer = new SecretStore.Writer(baos);

      byte[] plaintext = FathomdbCrypto.serialize(itemSecret);

      for (int backend : keyStore.getBackends()) {
        PublicKey publicKey = keyStore.findPublicKey(backend);
        if (publicKey != null) {
          writer.writeAsymetricSystemKey(plaintext, backend, publicKey);
        } else {
          throw new IllegalStateException();
        }
View Full Code Here

TOP

Related Classes of java.security.PublicKey

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.