Package cryptix.openpgp

Examples of cryptix.openpgp.PGPDetachedSignatureMessage


        // Read the detached signature
        //**********************************************************************
       
            
       
        PGPDetachedSignatureMessage detachedSig = null;
               
       
       
        try {
       
            MessageFactory mf = MessageFactory.getInstance("OpenPGP");
           
            //System.out.println(signed);
                     
            byte[] bm = PGPArmoury.unarmour(signed);
           
            detachedSig = (PGPDetachedSignatureMessage)
                           mf.generateMessages(new ByteArrayInputStream(bm)).iterator().next();
           
        } catch (NoSuchAlgorithmException nsae) {
            System.err.println("Cannot find the OpenPGP MessageFactory. "+
                "This usually means that the Cryptix OpenPGP provider is not "+
                "installed correctly.");
            nsae.printStackTrace();
            return;
        } catch (MessageException me) {
            System.err.println("Reading the message failed.");
            me.printStackTrace();
            return;
        } catch (IOException ioe) {
            System.err.println("Reading the message failed.");
            ioe.printStackTrace();
            return;
        }
       

        //**********************************************************************
        // Verify the message.
        //**********************************************************************
        try {
       
            if (detachedSig.verify(originalMsg, bundle)) {
                System.out.println("Signature OK");
               
            } else {
                System.out.println("Signature BAD");
            }
View Full Code Here

TOP

Related Classes of cryptix.openpgp.PGPDetachedSignatureMessage

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.