Package java.security.spec

Examples of java.security.spec.AlgorithmParameterSpec


                                          salt_v1,
                                          KEY_ITERATION_COUNT_V1,
                                          32);
      SecretKeyFactory skf = SecretKeyFactory.getInstance(KEY_FACTORY_V1);
      SecretKey key = skf.generateSecret(keyspec);
      AlgorithmParameterSpec aps = new PBEParameterSpec(salt_v1,
                                                        KEY_ITERATION_COUNT_V1);
      cipher = Cipher.getInstance(KEY_FACTORY_V1);
      cipher.init(Cipher.DECRYPT_MODE, key, aps);
    } catch (Exception ex) {
      Log.d(LOG_TAG, "createDecryptionCiphersV1", ex);
View Full Code Here


        if (!DSASupported) {
            fail(validAlgName + " algorithm is not supported");
            return;
        }
        SecureRandom random = new SecureRandom();
        AlgorithmParameterSpec aps = null;
        AlgorithmParameterGenerator[] apgs = createAPGen();
        assertNotNull("AlgorithmParameterGenerator objects were not created",
                apgs);
        for (int i = 0; i < apgs.length; i++) {
            try {
View Full Code Here

    private void checkResult(AlgorithmParameterGenerator algParGen)
            throws InvalidAlgorithmParameterException {
        AlgorithmParameters param = algParGen.generateParameters();
        assertNull("Not null parameters", param);
       
        AlgorithmParameterSpec pp = null;
        algParGen.init(pp, new SecureRandom());
        algParGen.init(pp);
        try {
            algParGen.init(pp, null);
            fail("IllegalArgumentException must be thrown");
View Full Code Here

        super(arg0);
    }

    private void checkResult(KeyPairGenerator keyPairGen, int mode)
            throws InvalidAlgorithmParameterException {
        AlgorithmParameterSpec pp = null;
        switch (mode) {
        case 1:
            try {
                keyPairGen.initialize(pp, new SecureRandom());
                fail("InvalidAlgorithmParameterException must be thrown");
View Full Code Here

        if (!WSConstants.C14N_EXCL_OMIT_COMMENTS.equals(c14nMethod)) {
            throw new WSSecurityException(WSSecurityException.INVALID_SECURITY, "badC14nAlgo");
        }

        // Not allowed HMAC OutputLength
        AlgorithmParameterSpec parameterSpec =
            xmlSignature.getSignedInfo().getSignatureMethod().getParameterSpec();
        if (parameterSpec instanceof HMACParameterSpec) {
            throw new WSSecurityException(WSSecurityException.INVALID_SECURITY, "R5401");
        }
       
View Full Code Here

    @Override
    public void marshalParams(XMLStructure parent, XMLCryptoContext context)
        throws MarshalException
    {
        super.marshalParams(parent, context);
        AlgorithmParameterSpec spec = getParameterSpec();
        if (spec == null) {
            return;
        }

        XmlWriterToTree xwriter = new XmlWriterToTree(Marshaller.getMarshallers(), transformElem);
View Full Code Here

        try
        {
            Cipher cipher = Cipher.getInstance( "DES/CBC/NoPadding" );
            SecretKey key = new SecretKeySpec( keyBytes, "DES" );

            AlgorithmParameterSpec paramSpec = new IvParameterSpec( iv );

            if ( isEncrypt )
            {
                cipher.init( Cipher.ENCRYPT_MODE, key, paramSpec );
            }
View Full Code Here

        if (!WSConstants.C14N_EXCL_OMIT_COMMENTS.equals(c14nMethod)) {
            bspEnforcer.handleBSPRule(BSPRule.R5404);
        }

        // Not allowed HMAC OutputLength
        AlgorithmParameterSpec parameterSpec =
            xmlSignature.getSignedInfo().getSignatureMethod().getParameterSpec();
        if (parameterSpec instanceof HMACParameterSpec) {
            bspEnforcer.handleBSPRule(BSPRule.R5401);
        }
       
View Full Code Here

        if (ObjectHelper.isNotEmpty(keyRef)) {
            Key key = CamelContextHelper.mandatoryLookup(routeContext.getCamelContext(), keyRef, Key.class);
            setProperty(cryptoFormat, "key", key);
        }
        if (ObjectHelper.isNotEmpty(algorithmParameterRef)) {
            AlgorithmParameterSpec spec = CamelContextHelper.mandatoryLookup(routeContext.getCamelContext(),
                    algorithmParameterRef, AlgorithmParameterSpec.class);
            setProperty(cryptoFormat, "AlgorithmParameterSpec", spec);
        }
        if (ObjectHelper.isNotEmpty(initVectorRef)) {
            byte[] iv = CamelContextHelper.mandatoryLookup(routeContext.getCamelContext(), initVectorRef, byte[].class);
View Full Code Here

    // Create an 8-byte initialization vector
    byte[] iv = new byte[]{
        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f
    };

    AlgorithmParameterSpec paramSpec = new IvParameterSpec(iv);

    try {
      ecipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
      dcipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
View Full Code Here

TOP

Related Classes of java.security.spec.AlgorithmParameterSpec

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.