Package cryptix.openpgp

Examples of cryptix.openpgp.PGPSignedMessage


              System.err.println("Generating the message failed.");
              me.printStackTrace();
              return null;
          }
         
          PGPSignedMessage message=null;
          //**********************************************************************
          // Sign the message.
          //**********************************************************************
          try {
         
              SignedMessageBuilder smb =
                  SignedMessageBuilder.getInstance("OpenPGP");

              smb.init(msg);
              smb.addSigner(secretKey, passpharse);

              message = (PGPSignedMessage)smb.build();
         
          } catch (NoSuchAlgorithmException nsae) {
              System.err.println("Cannot find the OpenPGP SignedMessageBuilder. "+
                  "This usually means that the Cryptix OpenPGP provider is not "+
                  "installed correctly.");
              nsae.printStackTrace();
              return null;
          } catch (UnrecoverableKeyException uke) {
              System.err.println("Incorrect passphrase.");
              uke.printStackTrace();
              return null;
          } catch (MessageException me) {
              System.err.println("Generating the message failed.");
              me.printStackTrace();
              return null;
          }

          //**********************************************************************
          // Armour the message.
          //**********************************************************************
          try{
            return  PGPArmoury.armour(message.getDetachedSignature().getEncoded());
          } catch (MessageException me) {
            System.err.println("Writing the message failed.");
            me.printStackTrace();
            return null;
          }
View Full Code Here

TOP

Related Classes of cryptix.openpgp.PGPSignedMessage

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.