Package br.net.woodstock.rockframework.security.store

Examples of br.net.woodstock.rockframework.security.store.PrivateKeyEntry


          break;
        case PRIVATE_KEY:
          PrivateKey privateKey = (PrivateKey) this.keyStore.getKey(name, this.toCharArray(password));
          if (privateKey != null) {
            Certificate[] chain = this.keyStore.getCertificateChain(name);
            entry = new PrivateKeyEntry(alias, privateKey, chain);
          }
          break;
        case PUBLIC_KEY:
          PublicKey publicKey = (PublicKey) this.keyStore.getKey(name, this.toCharArray(password));
          if (publicKey != null) {
View Full Code Here


        }
        break;
      case PRIVATE_KEY:
        Identity identity = this.privateKeyMap.get(alias.getName());
        if (identity != null) {
          entry = new PrivateKeyEntry(alias, identity.getPrivateKey(), identity.getChain());
        }
        break;
      case PUBLIC_KEY:
        PublicKey publicKey = this.publicKeyMap.get(alias.getName());
        if (publicKey != null) {
View Full Code Here

    JCAStore jcaStore = new JCAStore(KeyStoreType.JKS);
    for (Entry<String, Certificate> entry : this.certificateMap.entrySet()) {
      jcaStore.add(new CertificateEntry(new Alias(entry.getKey()), entry.getValue()));
    }
    for (Entry<String, Identity> entry : this.privateKeyMap.entrySet()) {
      jcaStore.add(new PrivateKeyEntry(new Alias(entry.getKey()), entry.getValue().getPrivateKey(), entry.getValue().getChain()));
    }
    for (Entry<String, PublicKey> entry : this.publicKeyMap.entrySet()) {
      jcaStore.add(new PublicKeyEntry(new Alias(entry.getKey()), entry.getValue()));
    }
    for (Entry<String, SecretKey> entry : this.secretKeyMap.entrySet()) {
View Full Code Here

  public BouncyCastleTimeStampServer(final Store store, final StoreAlias alias) {
    super();
    Assert.notNull(store, "store");
    Assert.notNull(alias, "alias");
    PrivateKeyEntry privateKeyEntry = (PrivateKeyEntry) store.get(alias);
    if (privateKeyEntry == null) {
      throw new TimeStampException("Private key not found for " + alias);
    }
    PrivateKey privateKey = privateKeyEntry.getValue();
    Certificate[] chain = privateKeyEntry.getChain();
    this.init(privateKey, chain);
  }
View Full Code Here

      if (signatureType == null) {
        signatureType = SignatureType.SHA1_RSA;
      }

      for (Alias alias : this.parameters.getAliases()) {
        PrivateKeyEntry privateKeyEntry = (PrivateKeyEntry) this.parameters.getStore().get(alias, StoreEntryType.PRIVATE_KEY);

        if (privateKeyEntry == null) {
          throw new SignerException("PrivateKey not found for alias '" + alias.getName() + "'");
        }

        PrivateKey privateKey = privateKeyEntry.getValue();
        Certificate[] chain = privateKeyEntry.getChain();
        Certificate certificate = chain[0];

        JcaContentSignerBuilder contentSignerBuilder = new JcaContentSignerBuilder(signatureType.getAlgorithm());
        if (ConditionUtils.isNotEmpty(this.parameters.getProvider())) {
          contentSignerBuilder.setProvider(this.parameters.getProvider());
View Full Code Here

  public BouncyCastleTimeStampServer(final Store store, final Alias alias) {
    super();
    Assert.notNull(store, "store");
    Assert.notNull(alias, "alias");
    PrivateKeyEntry privateKeyEntry = (PrivateKeyEntry) store.get(alias, StoreEntryType.PRIVATE_KEY);
    if (privateKeyEntry == null) {
      throw new TimeStampException("Private key not found for " + alias);
    }
    PrivateKey privateKey = privateKeyEntry.getValue();
    Certificate[] chain = privateKeyEntry.getChain();
    this.init(privateKey, chain);
  }
View Full Code Here

  private RandomGenerator      randomGenerator  = new RandomGenerator(32, RandomPattern.DIGITS);

  public BouncyCastleTimeStampServer(final Store store, final Alias alias) {
    super();
    try {
      PrivateKeyEntry privateKeyEntry = (PrivateKeyEntry) store.get(alias, StoreEntryType.PRIVATE_KEY);
      PrivateKey privateKey = privateKeyEntry.getValue();
      Certificate[] chain = privateKeyEntry.getChain();
      Certificate certificate = chain[0];

      JcaContentSignerBuilder contentSignerBuilder = new JcaContentSignerBuilder(SignatureType.SHA1_RSA.getAlgorithm());
      contentSignerBuilder.setProvider(BouncyCastleProviderHelper.PROVIDER_NAME);
View Full Code Here

  public SignatureRequest(final PrivateKeyHolder privateKeyHolder) {
    super();
    Alias alias = new Alias(SignatureRequest.DEFAULT_ALIAS_NAME);
    this.store = new MemoryStore();
    this.aliases = new Alias[] { alias };
    this.store.add(new PrivateKeyEntry(alias, privateKeyHolder.getPrivateKey(), privateKeyHolder.getChain()));
  }
View Full Code Here

      Alias[] aliases = this.request.getAliases();

      byte[] currentData = data;

      for (Alias alias : aliases) {
        PrivateKeyEntry privateKeyEntry = (PrivateKeyEntry) store.get(alias, StoreEntryType.PRIVATE_KEY);
        PrivateKey privateKey = privateKeyEntry.getValue();
        Certificate[] chain = privateKeyEntry.getChain();
        X509Certificate certificate = (X509Certificate) chain[0];
        PublicKey publicKey = certificate.getPublicKey();

        String digestType = this.getDigestMethodName(certificate.getSigAlgName());
        DigestMethod digestMethod = this.xmlSignatureFactory.newDigestMethod(digestType, null);
View Full Code Here

      Alias[] aliases = this.request.getAliases();

      boolean valid = true;

      for (Alias alias : aliases) {
        PrivateKeyEntry privateKeyEntry = (PrivateKeyEntry) store.get(alias, StoreEntryType.PRIVATE_KEY);
        Certificate[] chain = privateKeyEntry.getChain();
        X509Certificate certificate = (X509Certificate) chain[0];
        PublicKey publicKey = certificate.getPublicKey();

        ByteArrayInputStream inputStream = new ByteArrayInputStream(signature);
        Document document = this.documentBuilderFactory.newDocumentBuilder().parse(inputStream);
View Full Code Here

TOP

Related Classes of br.net.woodstock.rockframework.security.store.PrivateKeyEntry

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.