Examples of SignatureInfo


Examples of br.net.woodstock.rockframework.security.sign.SignatureInfo

            sig.getSignatories().add(signatory);
            sig.setTimeStamp(timeStamp);
            sig.setValid(valid);

            if ((Conditions.isNotEmpty(location)) || (Conditions.isNotEmpty(reason)) || (Conditions.isNotEmpty(signName))) {
              SignatureInfo info = new SignatureInfo(signName, reason, location, null);
              sig.setSignatureInfo(info);
            }

            signatures.add(sig);
          }
View Full Code Here

Examples of br.net.woodstock.rockframework.security.sign.SignatureInfo

            sig.getSignatories().add(signatory);
            sig.setTimeStamp(timeStamp);
            sig.setValid(valid);

            if ((ConditionUtils.isNotEmpty(location)) || (ConditionUtils.isNotEmpty(reason)) || (ConditionUtils.isNotEmpty(signName))) {
              SignatureInfo info = new SignatureInfo(signName, reason, location, null);
              sig.setSignatureInfo(info);
            }

            signatures.add(sig);
          }
View Full Code Here

Examples of br.net.woodstock.rockframework.security.sign.SignatureInfo

            sig.getSignatories().add(signatory);
            sig.setTimeStamp(timeStamp);
            sig.setValid(valid);

            if ((ConditionUtils.isNotEmpty(location)) || (ConditionUtils.isNotEmpty(reason)) || (ConditionUtils.isNotEmpty(signName))) {
              SignatureInfo info = new SignatureInfo(signName, reason, location, null);
              sig.setSignatureInfo(info);
            }

            signatures.add(sig);
          }
View Full Code Here

Examples of br.net.woodstock.rockframework.security.sign.SignatureInfo

            sig.getSignatories().add(signatory);
            sig.setTimeStamp(timeStamp);
            sig.setValid(valid);

            if ((ConditionUtils.isNotEmpty(location)) || (ConditionUtils.isNotEmpty(reason)) || (ConditionUtils.isNotEmpty(signName))) {
              SignatureInfo info = new SignatureInfo(signName, reason, location, null);
              sig.setSignatureInfo(info);
            }

            signatures.add(sig);
          }
View Full Code Here

Examples of com.sun.star.pgp.SignatureInfo

    // optional

    Runtime runtime = Runtime.getRuntime();
    Process proc  = null;
    SignatureInfo info =  null;
    try
    {
      proc = runtime.exec( params );
      // provide input
      OutputStream stdout = proc.getOutputStream();
View Full Code Here

Examples of com.sun.star.pgp.SignatureInfo

                   XInputStream aCipherText, XOutputStream aPlainText )
    throws IOException, PGPException
  {

    assumeAvailable();
     SignatureInfo info =  null;

      try
      {
      byte[][] readBuff= new byte[1][];
      int nRead;
      int nSizeLine=100;

      // read in the first 100 bytes
      nRead = aCipherText.readBytes( readBuff, nSizeLine );
   
      // Check if a pass phrase is required. This is not the case if
      // the text has just been signed and not encrypted. To find out
      // we look for the string "BEGIN PGP SIGNED MESSAGE". This only works
      // if pgp was used with options -sat !!!!
      // If a pass phrase is required than prompt the user for it
      String passPhrase= null;
      String text= new String( readBuff[0], 0, nSizeLine); //uses Default byte to character encoding
      if( text.indexOf("BEGIN PGP SIGNED MESSAGE") == -1){
        passPhrase= dialog.getPassPhrase();
        if( passPhrase == null)
          return null;
      }
      //---
      String params[] = new String[] { "pgp", "+batchmode", "+language=en", "-f",
                       "-z", passPhrase };
      Runtime runtime = Runtime.getRuntime();
      Process proc  = null;
     
      proc = runtime.exec( params );
      OutputStream stdout = proc.getOutputStream();
     
      // fed pgp with the actual text
      stdout.write( readBuff[0], 0, nRead); // write the formerly read data
      do
      {
        nRead = aCipherText.readBytes( readBuff, 0x10000 );
        if (DEBUG)
        {
          System.out.print( "# writing stdout: " );
          byte ar[] = readBuff[0];
          for ( int n = 0; n < nRead; ++n )
          {
            System.out.print( (char)ar[n] );
            if (n < ar.length-1)
              System.out.print( ", " );
          }
        }
        stdout.write( readBuff[0], 0, nRead);
      }
      while (nRead == 0x10000);
      stdout.close();
     
      // scan error stream
      BufferedReader stderr = new BufferedReader( new InputStreamReader( proc.getErrorStream() ) );
      String str;
     
      while ((str = stderr.readLine()) != null)
      {
        if (str.indexOf( "Error:" ) == 1)
        {
          proc.waitFor();
          throw new PGPException( str.substring( 7 ).trim() );
        }
        /* If text was signed then there is an output like:
         * Good signature from user "Joachim Lingner <jlingner@gmx.de>".
         */       
        else if (str.indexOf( "signature from user" ) != -1)
        {
          String user = str.substring( str.indexOf( '\"' )-1, str.lastIndexOf( '\"' ) ).trim();
          info = new SignatureInfo();
          info._userId      = user;
          info._bSignatureChecked = true;
          info._bMessageVerified  = (str.indexOf( "Good" ) == 0);
        }
        else if (str.indexOf( "Key matching expected Key ID" ) == 1)
        {         
          String user = str.substring( 28, str.indexOf( "not found" ) ).trim();
          info = new SignatureInfo();
          info._userId      = user;
          info._bSignatureChecked = false;
          info._bMessageVerified  = false;
        }
      }
View Full Code Here

Examples of com.sun.star.pgp.SignatureInfo

    // optional

    Runtime runtime = Runtime.getRuntime();
    Process proc  = null;
    SignatureInfo info =  null;
    try
    {
      proc = runtime.exec( params );
      // provide input
      OutputStream stdout = proc.getOutputStream();
View Full Code Here

Examples of com.sun.star.pgp.SignatureInfo

                   XInputStream aCipherText, XOutputStream aPlainText )
    throws IOException, PGPException
  {

    assumeAvailable();
     SignatureInfo info =  null;

      try
      {
      byte[][] readBuff= new byte[1][];
      int nRead;
      int nSizeLine=100;

      // read in the first 100 bytes
      nRead = aCipherText.readBytes( readBuff, nSizeLine );
   
      // Check if a pass phrase is required. This is not the case if
      // the text has just been signed and not encrypted. To find out
      // we look for the string "BEGIN PGP SIGNED MESSAGE". This only works
      // if pgp was used with options -sat !!!!
      // If a pass phrase is required than prompt the user for it
      String passPhrase= null;
      String text= new String( readBuff[0], 0, nSizeLine); //uses Default byte to character encoding
      if( text.indexOf("BEGIN PGP SIGNED MESSAGE") == -1){
        passPhrase= dialog.getPassPhrase();
        if( passPhrase == null)
          return null;
      }
      //---
      String params[];
      if( passPhrase == null)
        params= new String[]{"pgp", "+batchmode", "+language=en", "-f"};
      else
        params= new String[] { "pgp", "+batchmode", "+language=en", "-f", "-z", passPhrase };

      Runtime runtime = Runtime.getRuntime();
      Process proc  = null;
      proc = runtime.exec( params );

      OutputStream stdout = proc.getOutputStream();
     
      // fed pgp with the actual text
      stdout.write( readBuff[0], 0, nRead); // write the formerly read data
      do
      {
        nRead = aCipherText.readBytes( readBuff, 0x10000 );
        if (DEBUG)
        {
          System.out.print( "# writing stdout: " );
          byte ar[] = readBuff[0];
          for ( int n = 0; n < nRead; ++n )
          {
            System.out.print( (char)ar[n] );
            if (n < ar.length-1)
              System.out.print( ", " );
          }
        }
        stdout.write( readBuff[0], 0, nRead);
      }
      while (nRead == 0x10000);
      stdout.close();
     
      // scan error stream
      BufferedReader stderr = new BufferedReader( new InputStreamReader( proc.getErrorStream() ) );
      String str;
     
      while ((str = stderr.readLine()) != null)
      {
        if (str.indexOf( "Error:" ) == 1)
        {
//            proc.waitFor();
          throw new PGPException( str.substring( 7 ).trim() );
        }
        /* If text was signed then there is an output like:
         * Good signature from user "Joachim Lingner <jlingner@gmx.de>".
         */       
        else if (str.indexOf( "signature from user" ) != -1)
        {
          String user = str.substring( str.indexOf( '\"' )-1, str.lastIndexOf( '\"' ) ).trim();
          info = new SignatureInfo();
          info._userId      = user;
          info._bSignatureChecked = true;
          info._bMessageVerified  = (str.indexOf( "Good" ) == 0);
        }
        else if (str.indexOf( "Key matching expected Key ID" ) == 1)
        {         
          String user = str.substring( 28, str.indexOf( "not found" ) ).trim();
          info = new SignatureInfo();
          info._userId      = user;
          info._bSignatureChecked = false;
          info._bMessageVerified  = false;
        }
      }
View Full Code Here

Examples of org.apache.poi.poifs.crypt.dsig.SignatureInfo

       
        for (String testFile : testFiles) {
            OPCPackage pkg = OPCPackage.open(testdata.getFile(testFile), PackageAccess.READ);
            SignatureConfig sic = new SignatureConfig();
            sic.setOpcPackage(pkg);
            SignatureInfo si = new SignatureInfo();
            si.setSignatureConfig(sic);
            List<X509Certificate> result = new ArrayList<X509Certificate>();
            for (SignaturePart sp : si.getSignatureParts()) {
                if (sp.validate()) {
                    result.add(sp.getSigner());
                }
            }
            pkg.revert();
View Full Code Here

Examples of org.apache.poi.poifs.crypt.dsig.SignatureInfo

        for (String testFile : testFiles) {
            OPCPackage pkg = OPCPackage.open(testdata.getFile(testFile), PackageAccess.READ);
            try {
                SignatureConfig sic = new SignatureConfig();
                sic.setOpcPackage(pkg);
                SignatureInfo si = new SignatureInfo();
                si.setSignatureConfig(sic);
                List<X509Certificate> result = new ArrayList<X509Certificate>();
                for (SignaturePart sp : si.getSignatureParts()) {
                    if (sp.validate()) {
                        result.add(sp.getSigner());
                    }
                }
   
                assertNotNull(result);
                assertEquals("test-file: "+testFile, 1, result.size());
                X509Certificate signer = result.get(0);
                LOG.log(POILogger.DEBUG, "signer: " + signer.getSubjectX500Principal());
   
                boolean b = si.verifySignature();
                assertTrue("test-file: "+testFile, b);
                pkg.revert();
            } finally {
                pkg.close();
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.