Examples of BouncyCastleProvider


Examples of org.bouncycastle.jce.provider.BouncyCastleProvider

     * is generated with each invocation (redeploy/reboot).
     *
     * @throws java.lang.Exception
     */
    @Override public final void afterPropertiesSet() throws Exception {
        Security.addProvider(new BouncyCastleProvider());
        cipherer = Cipher.getInstance("DESede/ECB/PKCS5Padding", "BC");
        SecretKey key = getEncryptionKey();
        cipherer.init(Cipher.ENCRYPT_MODE, key);
        decipherer = Cipher.getInstance("DESede/ECB/PKCS5Padding", "BC");
        decipherer.init(Cipher.DECRYPT_MODE, key);
View Full Code Here

Examples of org.bouncycastle.jce.provider.BouncyCastleProvider

     *
     * @throws java.lang.Exception
     */
    @PostConstruct
    public final DES3CiphererDecipherer init() throws Exception {
        Security.addProvider(new BouncyCastleProvider());
        cipherer = Cipher.getInstance("DESede/ECB/PKCS5Padding", "BC");
        KeyGenerator keyGen = KeyGenerator.getInstance("DESede");
        keyGen.init(168);
        SecretKey key = keyGen.generateKey();
        cipherer.init(Cipher.ENCRYPT_MODE, key);
View Full Code Here

Examples of org.bouncycastle.jce.provider.BouncyCastleProvider

    public void prepareDocumentForEncryption(PDDocument doc) throws CryptographyException
    {
       
        try
        {
            Security.addProvider(new BouncyCastleProvider());
           
            PDEncryptionDictionary dictionary = doc.getEncryptionDictionary();
           
            dictionary.setFilter(FILTER);
            dictionary.setLength(this.keyLength);           
View Full Code Here

Examples of org.bouncycastle.jce.provider.BouncyCastleProvider

    {
        if(instance == null)
        {
            instance = new SecurityHandlersManager();
        }
        Security.addProvider(new BouncyCastleProvider());
       
        return instance;
    }   
View Full Code Here

Examples of org.bouncycastle.jce.provider.BouncyCastleProvider

        public void run()
                throws Exception {
            if (java.security.Security.getProvider(BOUNCY_CASTLE) == null) {
                LOG.info("Trying to register BouncyCastle as a JCE provider");
                java.security.Security.addProvider(new BouncyCastleProvider());
                MessageDigest.getInstance("MD5", BOUNCY_CASTLE);
                KeyAgreement.getInstance("DH", BOUNCY_CASTLE);
                LOG.info("Registration succeeded");
            } else
                LOG.info("BouncyCastle already registered as a JCE provider");
View Full Code Here

Examples of org.bouncycastle.jce.provider.BouncyCastleProvider

    ECDH alice;
    ECDH bob;
   
    protected void setUp() throws Exception {
        super.setUp();
        Security.addProvider(new BouncyCastleProvider());
        curveToTest = Curves.P256;
        alice = new ECDH(curveToTest);
        bob = new ECDH(curveToTest);
    }
View Full Code Here

Examples of org.bouncycastle.jce.provider.BouncyCastleProvider

        assertEquals(bobP.getEncoded().length, curveToTest.modulusSize);
    }


    public static void main(String[] args) throws InvalidKeyException, IllegalStateException, NoSuchAlgorithmException {
        Security.addProvider(new BouncyCastleProvider());
       
        ECDH alice = new ECDH(Curves.P256);
        ECDH bob = new ECDH(Curves.P256);
        PublicKey bobP = bob.getPublicKey();
        PublicKey aliceP = alice.getPublicKey();
View Full Code Here

Examples of org.bouncycastle.jce.provider.BouncyCastleProvider

    }

    public static void main(
        String[]    args)
    {
        Security.addProvider(new BouncyCastleProvider());

        runTest(new RSATest());
    }
View Full Code Here

Examples of org.bouncycastle.jce.provider.BouncyCastleProvider

   

    public static void main(
        String[]    args)
    {
        Security.addProvider(new BouncyCastleProvider());

        runTest(new NISTCertPathTest());
    }
View Full Code Here

Examples of org.bouncycastle.jce.provider.BouncyCastleProvider

    {
        DHParameterSpec             dhParams = new DHParameterSpec(p, g, privateValueSize);
        String                      algName = "DH";
        int                         size = p.bitLength();

        new BouncyCastleProvider().setParameter(ConfigurableProvider.DH_DEFAULT_PARAMS, dhParams);

    KeyPairGenerator keyGen = KeyPairGenerator.getInstance(algName, "BC");

        keyGen.initialize(dhParams.getP().bitLength());

        testTwoParty("DH", size, privateValueSize, keyGen);

        KeyPair aKeyPair = keyGen.generateKeyPair();

        new BouncyCastleProvider().setParameter(ConfigurableProvider.DH_DEFAULT_PARAMS, null);

        //
        // public key encoding test
        //
        byte[]              pubEnc = aKeyPair.getPublic().getEncoded();
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.