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

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


            String signName = pk.getSignName();
            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


    super.init(config);
    try {
      BouncyCastleTimeStampConfig timeStampConfig = this.getConfig();
      InputStream inputStream = Resources.getResourceAsStream(timeStampConfig.getStoreResource());

      Store store = new JCAStore(KeyStoreType.valueOf(timeStampConfig.getStoreType()));
      store.read(inputStream, timeStampConfig.getStorePassword());

      StoreAlias alias = new PasswordAlias(timeStampConfig.getKeyAlias(), timeStampConfig.getKeyPassword());

      this.timeStampServer = new BouncyCastleTimeStampServer(store, alias);
    } catch (Exception e) {
View Full Code Here

    super.init(config);
    try {
      BouncyCastleTimeStampConfig timeStampConfig = this.getConfig();
      InputStream inputStream = ClassLoaderUtils.getResourceAsStream(timeStampConfig.getStoreResource());

      Store store = new JCAStore(KeyStoreType.valueOf(timeStampConfig.getStoreType()));
      store.read(inputStream, timeStampConfig.getStorePassword());

      Alias alias = new PasswordAlias(timeStampConfig.getKeyAlias(), timeStampConfig.getKeyPassword());

      this.timeStampServer = new BouncyCastleTimeStampServer(store, alias);
    } catch (Exception e) {
View Full Code Here

  @Override
  public byte[] sign(final byte[] data) {
    Assert.notEmpty(data, "data");
    try {
      Store store = this.request.getStore();
      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();
View Full Code Here

  @Override
  public boolean verify(final byte[] data, final byte[] signature) {
    Assert.notEmpty(data, "data");
    Assert.notEmpty(signature, "signature");
    try {
      Store store = this.request.getStore();
      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);
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");
      }
View Full Code Here

            String reason = pk.getReason();
            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;
            }

            TimeStampToken timeStampToken = pk.getTimeStampToken();
View Full Code Here

    super.init(config);
    try {
      BouncyCastleTimeStampConfig timeStampConfig = this.getConfig();
      InputStream inputStream = ClassLoaderUtils.getResourceAsStream(timeStampConfig.getStoreResource());

      Store store = new JCAStore(KeyStoreType.valueOf(timeStampConfig.getStoreType()));
      store.read(inputStream, timeStampConfig.getStorePassword());

      Alias alias = new PasswordAlias(timeStampConfig.getKeyAlias(), timeStampConfig.getKeyPassword());

      this.timeStampServer = new BouncyCastleTimeStampServer(store, alias);
    } catch (Exception e) {
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");
      }
View Full Code Here

            String reason = pk.getReason();
            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;
            }

            TimeStampToken timeStampToken = pk.getTimeStampToken();
View Full Code Here

TOP

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

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.