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

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


      switch (type) {
        case CERTIFICATE:
          Certificate certificate = this.keyStore.getCertificate(alias.getName());
          if (certificate != null) {
            entry = new CertificateEntry(alias, certificate);
          }
          break;
        case PRIVATE_KEY:
          PrivateKey privateKey = (PrivateKey) this.keyStore.getKey(name, this.toCharArray(password));
          if (privateKey != null) {
View Full Code Here


    switch (type) {
      case CERTIFICATE:
        Certificate certificate = this.certificateMap.get(alias.getName());
        if (certificate != null) {
          entry = new CertificateEntry(alias, certificate);
        }
        break;
      case PRIVATE_KEY:
        Identity identity = this.privateKeyMap.get(alias.getName());
        if (identity != null) {
View Full Code Here

  @Override
  public KeyStore toKeyStore() {
    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()) {
View Full Code Here

            Date date = pk.getSignDate().getTime();
            Boolean valid = Boolean.TRUE;
            Signatory signatory = this.toSignatory(certificate);

            Store store = new JCAStore(KeyStoreType.JKS);
            store.add(new CertificateEntry(new Alias(certificate.getSerialNumber().toString()), certificate));

            if (pk.verify()) {
              valid = Boolean.FALSE;
            }
View Full Code Here

  private byte[] singleSign(final byte[] data, final Alias alias) {
    Assert.notEmpty(data, "data");
    try {
      Store store = this.request.getStore();
      CertificateEntry certificateEntry = (CertificateEntry) store.get(alias, StoreEntryType.CERTIFICATE);
      PrivateKeyEntry privateEntry = (PrivateKeyEntry) store.get(alias, StoreEntryType.PRIVATE_KEY);

      if (certificateEntry == null) {
        throw new SignerException("Certificate '" + alias.getName() + " not found in store");
      }

      if (privateEntry == null) {
        throw new SignerException("Private key '" + alias.getName() + " not found in store");
      }

      ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
      X509Certificate certificate = (X509Certificate) certificateEntry.getValue();
      PrivateKey privateKey = privateEntry.getValue();
      Certificate[] chain = privateEntry.getChain();

      DigestType digestType = this.getDigestTypeFromSignature(certificate.getSigAlgName());
      Calendar calendar = Calendar.getInstance();
View Full Code Here

            Date date = pk.getSignDate().getTime();
            Boolean valid = Boolean.TRUE;
            Signatory signatory = this.toSignatory(certificate);

            Store store = new JCAStore(KeyStoreType.JKS);
            store.add(new CertificateEntry(new Alias(certificate.getSerialNumber().toString()), certificate));
            Object[] fails = PdfPKCS7.verifyCertificates(chain, store.toKeyStore(), pk.getCRLs(), pk.getSignDate());
            if (ConditionUtils.isNotEmpty(fails)) {
              valid = Boolean.FALSE;
            }
View Full Code Here

      switch (type) {
        case CERTIFICATE:
          Certificate certificate = this.keyStore.getCertificate(alias.getName());
          if (certificate != null) {
            entry = new CertificateEntry(alias, certificate);
          }
          break;
        case PRIVATE_KEY:
          PrivateKey privateKey = (PrivateKey) this.keyStore.getKey(name, this.toCharArray(password));
          if (privateKey != null) {
View Full Code Here

    switch (type) {
      case CERTIFICATE:
        Certificate certificate = this.certificateMap.get(alias.getName());
        if (certificate != null) {
          entry = new CertificateEntry(alias, certificate);
        }
        break;
      case PRIVATE_KEY:
        PrivateKeyHolder holder = this.privateKeyMap.get(alias.getName());
        if (holder != null) {
View Full Code Here

  @Override
  public KeyStore toKeyStore() {
    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, PrivateKeyHolder> 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()) {
View Full Code Here

  private byte[] singleSign(final byte[] data, final Alias alias) {
    Assert.notEmpty(data, "data");
    try {
      Store store = this.parameters.getStore();
      CertificateEntry certificateEntry = (CertificateEntry) store.get(alias, StoreEntryType.CERTIFICATE);
      PrivateKeyEntry privateEntry = (PrivateKeyEntry) store.get(alias, StoreEntryType.PRIVATE_KEY);

      if (certificateEntry == null) {
        throw new SignerException("Certificate '" + alias.getName() + " not found in store");
      }

      if (privateEntry == null) {
        throw new SignerException("Private key '" + alias.getName() + " not found in store");
      }

      ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
      X509Certificate certificate = (X509Certificate) certificateEntry.getValue();
      PrivateKey privateKey = privateEntry.getValue();
      Certificate[] chain = privateEntry.getChain();

      DigestType digestType = this.getDigestTypeFromSignature(certificate.getSigAlgName());
      Calendar calendar = Calendar.getInstance();
View Full Code Here

TOP

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

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.