Package fr.jayasoft.crypto.decoder

Examples of fr.jayasoft.crypto.decoder.Decoder


    public void doTestAlgo(String algo) {
      System.out.println("Testing: " + algo);
        Crypto c = CryptoFactory.get(algo);
        KeyGenerator kg = c.getKeyGenerator();
        Encoder e = c.newEncoder(kg.getEncodingKey());
        Decoder d = c.newDecoder(kg.getDecodingKey());
       
        encodeDecodeProperties(e,d);
    }
View Full Code Here


        _confDir = _installDir +  "/conf";
        System.out.println("WOJ server conf dir set to: " + _confDir);
       
        initContextProperty(p, "crypto.algo", CryptoFactory.RSA);
       
        Decoder wojDecoder = null;
        try {
            wojDecoder = getWojDecoder();
        } catch (Throwable t) {
            LOGGER.warn("cannot instanciate WOJ decoder", t);
            throw new IllegalStateException("cannot instanciate WOJ decoder");
View Full Code Here

        Object decKey = kg.getDecodingKey(decodingKey);
        Object encKey = kg.getEncodingKey(encodingKey);
       
       
        Encoder e = c.newEncoder(encKey);
        Decoder d = c.newDecoder(decKey);
       
        String msg = "just a simple message";
        assertEquals(msg, d.decodeAsString(e.encode(msg)));
    }
View Full Code Here

    public void doTestAlgo(String algo) {
        System.out.println("testing: " + algo);
        Crypto c = CryptoFactory.get(algo);
        KeyGenerator kg = c.getKeyGenerator();
        Encoder e = c.newEncoder(kg.getEncodingKey());
        Decoder d = c.newDecoder(kg.getDecodingKey());
       
        System.out.println("--> bytes testing");
        encodeBytes(e,d);
        System.out.println("--> short string testing");
        encodeString(e,d,"test");
View Full Code Here

            e.setEncodingKey(key);
            return e;
        }

        public Decoder newDecoder(Object key) {
            Decoder d = newDecoder();
            d.setDecodingKey(key);
            return d;
        }
View Full Code Here

            assertTrue(fPubKey.length()!=0);
           
            String valToEncode = "some value";
           
            Encoder e = EncoderUtils.createRSAEncoder(fPubKey);
            Decoder d = DecoderUtils.createRSADecoder(fPriKey);
           
            byte[] decodedValue  = d.decode(e.encode(valToEncode.getBytes()));
            assertEquals(valToEncode, new String(decodedValue));
        } catch (IOException e) {
            assertTrue(false);
        }
    }
View Full Code Here

TOP

Related Classes of fr.jayasoft.crypto.decoder.Decoder

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.