Package javax.xml.crypto.dsig.keyinfo

Examples of javax.xml.crypto.dsig.keyinfo.KeyInfoFactory.newKeyValue()


        rsaKeyPair = KeyPairGenerator.getInstance("RSA").genKeyPair();
        ecKeyPair = KeyPairGenerator.getInstance("EC").genKeyPair();
       
        KeyInfoFactory kifac = fac.getKeyInfoFactory();
        rsaki = kifac.newKeyInfo(Collections.singletonList
                                 (kifac.newKeyValue(rsaKeyPair.getPublic())));
        ecki = kifac.newKeyInfo(Collections.singletonList
                                (kifac.newKeyValue(ecKeyPair.getPublic())));
    }

    @org.junit.Test
View Full Code Here


       
        KeyInfoFactory kifac = fac.getKeyInfoFactory();
        rsaki = kifac.newKeyInfo(Collections.singletonList
                                 (kifac.newKeyValue(rsaKeyPair.getPublic())));
        ecki = kifac.newKeyInfo(Collections.singletonList
                                (kifac.newKeyValue(ecKeyPair.getPublic())));
    }

    @org.junit.Test
    public void testRSA_SHA1() throws Exception {
        test_create_signature_enveloping(rsaSha1, sha1, rsaki,
View Full Code Here

       
        rsaSha1 = fac.newSignatureMethod
            ("http://www.w3.org/2000/09/xmldsig#rsa-sha1", null);
       
        rsaki = kifac.newKeyInfo(Collections.singletonList
                                 (kifac.newKeyValue(
                                  TestUtils.getPublicKey("RSA"))));
       
        kvks = new KeySelectors.KeyValueKeySelector();
    }
View Full Code Here

            String signatureMethodString = publicKey.getAlgorithm().equalsIgnoreCase("RSA") ? SignatureMethod.RSA_SHA1 : SignatureMethod.DSA_SHA1;
            SignatureMethod signatureMethod = fac.newSignatureMethod(signatureMethodString, null);
            SignedInfo si = fac.newSignedInfo(canonicalizationMethod, signatureMethod, referenceList);

            KeyInfoFactory kif = fac.getKeyInfoFactory();
            KeyValue kv = kif.newKeyValue(publicKey);
            KeyInfo ki = kif.newKeyInfo(Collections.singletonList(kv));

            XMLSignature signature = fac.newXMLSignature(si, ki);

            signature.sign(dsc);
View Full Code Here

        rsaKeyPair = KeyPairGenerator.getInstance("RSA").genKeyPair();
        ecKeyPair = KeyPairGenerator.getInstance("EC").genKeyPair();
       
        KeyInfoFactory kifac = fac.getKeyInfoFactory();
        rsaki = kifac.newKeyInfo(Collections.singletonList
                                 (kifac.newKeyValue(rsaKeyPair.getPublic())));
    }

    @org.junit.Test
    public void testRSA_SHA1() throws Exception {
        if (!bouncyCastleAvailable) {
View Full Code Here

       
        rsaSha1 = fac.newSignatureMethod
            ("http://www.w3.org/2000/09/xmldsig#rsa-sha1", null);
       
        rsaki = kifac.newKeyInfo(Collections.singletonList
                                 (kifac.newKeyValue(
                                  TestUtils.getPublicKey("RSA"))));
       
        kvks = new KeySelectors.KeyValueKeySelector();
    }
View Full Code Here

         String signatureMethodString = publicKey.getAlgorithm().equalsIgnoreCase("RSA") ? SignatureMethod.RSA_SHA1 : SignatureMethod.DSA_SHA1;
         SignatureMethod signatureMethod = fac.newSignatureMethod(signatureMethodString, null);
         SignedInfo si = fac.newSignedInfo(canonicalizationMethod, signatureMethod, referenceList);

         KeyInfoFactory kif = fac.getKeyInfoFactory();
         KeyValue kv = kif.newKeyValue(publicKey);
         KeyInfo ki = kif.newKeyInfo(Collections.singletonList(kv));

         XMLSignature signature = fac.newXMLSignature(si, ki);

         signature.sign(dsc);
View Full Code Here

                    .singletonList(ref));

            // Create a KeyValue containing the DSA or RSA PublicKey
            final KeyInfoFactory keyInfoFactory = sigFactory
                .getKeyInfoFactory();
            final KeyValue keyValuePair = keyInfoFactory.newKeyValue(pubKey);

            // Create a KeyInfo and add the KeyValue to it
            final KeyInfo keyInfo = keyInfoFactory.newKeyInfo(Collections
                .singletonList(keyValuePair));
            // Convert the JDOM document to w3c (Java XML signature API requires
View Full Code Here

        SignatureMethod signatureMethod = this.xmlSignatureFactory.newSignatureMethod(SignatureMethod.RSA_SHA1, null);

        this.signedInfo = this.xmlSignatureFactory.newSignedInfo(canonicalizationMethod, signatureMethod, Collections.singletonList(reference));

        KeyInfoFactory keyInfoFactory = this.xmlSignatureFactory.getKeyInfoFactory();
        KeyValue keyValue = keyInfoFactory.newKeyValue(publicKey);
        this.keyInfo = keyInfoFactory.newKeyInfo(Collections.singletonList(keyValue));

        ByteArrayInputStream inputStream = new ByteArrayInputStream(currentData);

        Document document = this.documentBuilderFactory.newDocumentBuilder().parse(inputStream);
View Full Code Here

 
      SignedInfo signedInfo = signFactory.newSignedInfo(signFactory.newCanonicalizationMethod(CanonicalizationMethod.INCLUSIVE,(C14NMethodParameterSpec)null),signFactory.newSignatureMethod(SignatureMethod.RSA_SHA1,null),references);
 
      List<XMLStructure> keyInfoElements = new ArrayList<XMLStructure>();
      KeyInfoFactory keyInfoFactory = signFactory.getKeyInfoFactory();
      keyInfoElements.add(keyInfoFactory.newKeyValue(keyPair.getPublic()));
 
      Certificate[] certificates = keyStore.getCertificateChain(alias);
      //keyInfoElements.add(keyInfoFactory.newX509Data(Arrays.asList(certificates)));
      keyInfoElements.add(keyInfoFactory.newX509Data(Collections.singletonList(certificates[0])));
 
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.