Examples of KeyValueType


Examples of org.picketlink.identity.federation.core.config.KeyValueType

        Handler handler = handlerList.get(0);
        assertEquals("Class Name", "a", handler.getClazz());
        List<KeyValueType> options = handler.getOption();
        assertEquals("2 options", 2, options.size());
        KeyValueType k1 = options.get(0);
        assertEquals("1", "1", k1.getKey());
        assertEquals("1.1", "1.1", k1.getValue());
        KeyValueType k2 = options.get(1);
        assertEquals("2", "2", k2.getKey());
        assertEquals("2.2", "2.2", k2.getValue());
    }
View Full Code Here

Examples of org.picketlink.identity.federation.core.config.KeyValueType

        assertNotNull("MetadataProvider is not null", metaDataProvider);
        assertEquals("org.jboss.test.somefqn", metaDataProvider.getClassName());

        List<KeyValueType> keyValues = metaDataProvider.getOption();
        assertTrue(1 == keyValues.size());
        KeyValueType kvt = keyValues.get(0);
        assertEquals("FileName", kvt.getKey());
        assertEquals("myfile", kvt.getValue());
    }
View Full Code Here

Examples of org.picketlink.identity.xmlsec.w3.xmldsig.KeyValueType

                        if (elementName.equals("X509Certificate")) {
                            X509DataType data = new X509DataType();
                            data.add(value);
                            value = data;
                        } else if(elementName.equals("KeyValue")){
                           KeyValueType keyValue = null;
                           Element child = DocumentUtil.getChildElement(keyElement, new QName(WSTrustConstants.XMLDSig.RSA_KEYVALUE));
                           if(child != null){
                               try {
                                keyValue = XMLSignatureUtil.getRSAKeyValue(child);
                            } catch (ParsingException e) {
View Full Code Here

Examples of org.picketlink.identity.xmlsec.w3.xmldsig.KeyValueType

                EndElement endElement = StaxParserUtil.getNextEndElement(xmlEventReader);
                StaxParserUtil.validate(endElement, WSTrustConstants.XMLDSig.X509DATA);
                keyInfo.addContent(x509);
            } else if (tag.equals(WSTrustConstants.XMLDSig.KEYVALUE)) {
                startElement = StaxParserUtil.getNextStartElement(xmlEventReader);
                KeyValueType keyValue = null;

                startElement = StaxParserUtil.peekNextStartElement(xmlEventReader);
                tag = StaxParserUtil.getStartElementName(startElement);
                if (tag.equals(WSTrustConstants.XMLDSig.RSA_KEYVALUE)) {
                    keyValue = parseRSAKeyValue(xmlEventReader);
View Full Code Here

Examples of org.picketlink.identity.xmlsec.w3.xmldsig.KeyValueType

                EndElement endElement = StaxParserUtil.getNextEndElement(xmlEventReader);
                StaxParserUtil.validate(endElement, WSTrustConstants.XMLDSig.X509DATA);
                keyInfo.addContent(x509);
            } else if (tag.equals(WSTrustConstants.XMLDSig.KEYVALUE)) {
                startElement = StaxParserUtil.getNextStartElement(xmlEventReader);
                KeyValueType keyValue = null;

                startElement = StaxParserUtil.peekNextStartElement(xmlEventReader);
                tag = StaxParserUtil.getStartElementName(startElement);
                if (tag.equals(WSTrustConstants.XMLDSig.RSA_KEYVALUE)) {
                    keyValue = parseRSAKeyValue(xmlEventReader);
View Full Code Here

Examples of org.picketlink.identity.xmlsec.w3.xmldsig.KeyValueType

                StaxUtil.writeCharacters(writer, new String(cert.getEncodedCertificate()));
                StaxUtil.writeEndElement(writer);
            }
            StaxUtil.writeEndElement(writer);
        } else if( content instanceof KeyValueType){
            KeyValueType keyvalueType = (KeyValueType) content;
            StaxUtil.writeStartElement(writer, WSTrustConstants.XMLDSig.DSIG_PREFIX, WSTrustConstants.XMLDSig.KEYVALUE,
                    WSTrustConstants.XMLDSig.DSIG_NS);
            if(keyvalueType instanceof DSAKeyValueType){
                StaxUtil.writeDSAKeyValueType(writer, (DSAKeyValueType) keyvalueType);
            }
View Full Code Here

Examples of org.picketlink.identity.xmlsec.w3.xmldsig.KeyValueType

                "http://services.testcorp.org/provider2");
        request.setKeyType(URI.create(WSTrustConstants.KEY_TYPE_PUBLIC));

        // include a UseKey section that sets the public key in the request.
        Certificate certificate = this.getCertificate("keystore/sts_keystore.jks", "testpass", "service1");
        KeyValueType keyValue = WSTrustUtil.createKeyValue(certificate.getPublicKey());
        UseKeyType useKey = new UseKeyType();
        useKey.add(keyValue);
        request.setUseKey(useKey);

        // invoke the token service.
View Full Code Here

Examples of org.picketlink.identity.xmlsec.w3.xmldsig.KeyValueType

        }
        // if the key is public, KeyInfo should either contain an encoded certificate or an encoded public key.
        else if (WSTrustConstants.KEY_TYPE_PUBLIC.equals(keyType)) {
            // if the public key has been used as proof, we should be able to retrieve it from KeyValueType.
            if (usePublicKey == true) {
                KeyValueType keyValue = (KeyValueType) keyInfo.getContent().get(0);
                RSAKeyValueType rsaKeyValue = (RSAKeyValueType) keyValue;

                // reconstruct the public key and check if it matches the public key of the provided certificate.
                BigInteger modulus = new BigInteger(1, Base64.decode(new String(rsaKeyValue.getModulus())));
                BigInteger exponent = new BigInteger(1, Base64.decode(new String(rsaKeyValue.getExponent())));
View Full Code Here

Examples of org.w3._2000._09.xmldsig_.KeyValueType

       if(cert.getPublicKey() instanceof RSAPublicKey){ 
         RSAPublicKey pubKey = (RSAPublicKey) cert.getPublicKey();       
         RSAKeyValueType rSAKeyValueType = sigFactory.createRSAKeyValueType();
         rSAKeyValueType.setModulus(pubKey.getModulus().toByteArray());
         rSAKeyValueType.setExponent(pubKey.getPublicExponent().toByteArray());
         KeyValueType keyValue = sigFactory.createKeyValueType();
         keyValue.getContent().add(sigFactory.createRSAKeyValue(rSAKeyValueType));
         keyInfoType.getContent().add(sigFactory.createKeyValue(keyValue));                         
       }else{
         log.error(intres.getLocalizedMessage("xkms.onlyrsakeysupported"));        
         resultMajor = XKMSConstants.RESULTMAJOR_RECIEVER;
         resultMinor = XKMSConstants.RESULTMINOR_FAILURE;
View Full Code Here

Examples of org.w3._2000._09.xmldsig_.KeyValueType

                        }
                       
                        JAXBElement dataJAXB = new JAXBElement(new QName("http://www.w3.org/2000/09/xmldsig#", tagName), SPKIDataType.class, spkiDataType);
                        parentKeyDataList.add(dataJAXB);
                    } else if (dataType.equals(KeyValueType.class.getSimpleName())) {
                        KeyValueType keyValueType = new KeyValueType();
                        for (KeyDataValue keyValueDataKDV : modelKeyDataValue.getKeyDataValueList()) {
                            for (KeyDataValue keyValueDataChildKDV : keyValueDataKDV.getKeyDataValueList()) {
                                String keyDataDataType = keyValueDataChildKDV.getKeyDataType();
                                if (keyDataDataType.equals("DSAKeyValueType")) {
                                    DSAKeyValueType dsaKeyValueType = new DSAKeyValueType();
                                    for (KeyDataValue dsaKDV : keyValueDataChildKDV.getKeyDataValueList()) {
                                        if ("G".equals(dsaKDV.getKeyDataName())) {
                                            dsaKeyValueType.setG(dsaKDV.getKeyDataValueBytes());
                                        } else if ("P".equals(dsaKDV.getKeyDataName())) {
                                            dsaKeyValueType.setP(dsaKDV.getKeyDataValueBytes());
                                        } else if ("Q".equals(dsaKDV.getKeyDataName())) {
                                            dsaKeyValueType.setQ(dsaKDV.getKeyDataValueBytes());
                                        } else if ("Y".equals(dsaKDV.getKeyDataName())) {
                                            dsaKeyValueType.setY(dsaKDV.getKeyDataValueBytes());
                                        } else if ("J".equals(dsaKDV.getKeyDataName())) {
                                            dsaKeyValueType.setJ(dsaKDV.getKeyDataValueBytes());
                                        } else if ("Seed".equals(dsaKDV.getKeyDataName())) {
                                            dsaKeyValueType.setSeed(dsaKDV.getKeyDataValueBytes());
                                        } else if ("PgenCounter".equals(dsaKDV.getKeyDataName())) {
                                            dsaKeyValueType.setPgenCounter(dsaKDV.getKeyDataValueBytes());
                                        } else {
                                            throw new RuntimeException("Unrecognized dsa type: " + dsaKDV.getKeyDataName());
                                        }
                                    }
                                    JAXBElement jaxb = new JAXBElement(new QName("http://www.w3.org/2000/09/xmldsig#", keyValueDataChildKDV.getKeyDataName()), DSAKeyValueType.class, dsaKeyValueType);
                                    keyValueType.getContent().add(jaxb);
                                } else if (keyDataDataType.equals("RSAKeyValueType")) {
                                    RSAKeyValueType rsaKeyValueType = new RSAKeyValueType();
                                    for (KeyDataValue rsaKDV : keyValueDataChildKDV.getKeyDataValueList()) {
                                        if ("Exponent".equals(rsaKDV.getKeyDataName())) {
                                            rsaKeyValueType.setExponent(rsaKDV.getKeyDataValueBytes());
                                        } else if ("Modulus".equals(rsaKDV.getKeyDataName())) {
                                            rsaKeyValueType.setModulus(rsaKDV.getKeyDataValueBytes());
                                        } else {
                                            throw new RuntimeException("Unrecognized dsa type: " + rsaKDV.getKeyDataName());
                                        }
                                    }
                                    JAXBElement jaxb = new JAXBElement(new QName("http://www.w3.org/2000/09/xmldsig#", keyValueDataChildKDV.getKeyDataName()), RSAKeyValueType.class, rsaKeyValueType);
                                    keyValueType.getContent().add(jaxb);
                                } else {
                                    throw new RuntimeException("Unrecognized element: " + keyDataDataType);
                                }
                            }
                        }
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.