Examples of PrototypeKeyBinding


Examples of org.wso2.xkms2.PrototypeKeyBinding

        Authentication authentication = new Authentication();
        return authentication;
    }

    public static PrototypeKeyBinding createPrototypeKeyBinding() {
        PrototypeKeyBinding keyBinding = new PrototypeKeyBinding();
        keyBinding.setId(XKMSUtil.getRamdomId());
        return keyBinding;
    }
View Full Code Here

Examples of org.wso2.xkms2.PrototypeKeyBinding

    }

    private PrototypeKeyBinding prototypeKeyBinding;

    public XKMSElement buildElement(OMElement element) throws XKMSException {
        prototypeKeyBinding = new PrototypeKeyBinding();
        super.buildElement(element, prototypeKeyBinding);

        OMElement validityIntervalEle = element
                .getFirstChildWithName(XKMS2Constants.ELE_VALIDITY_INTERVAL);
View Full Code Here

Examples of org.wso2.xkms2.PrototypeKeyBinding

        try {
            prepare(request, request.getPrototypeKeyBinding());
            validate(request);

            PrototypeKeyBinding pkb = request.getPrototypeKeyBinding();
            String identifer = getSubjectDN(pkb);

            if (identifer == null) {
                if (LOG.isDebugEnabled()) {
                    LOG.debug("No SubjectDN is specified");
                }

                throw new XKMSException(XKMSException.FAILURE, "NoSubjectDN");
            }

            PublicKey public1 = pkb.getKeyValue();
            PrivateKey private1 = null;

            // if a public key is not provided we need to generate both the
            // public key and private key
            if (public1 == null) {
                KeyPair keypair = XKMSKeyUtil.generateRSAKeyPair();
                public1 = keypair.getPublic();
                private1 = keypair.getPrivate();
            }

            // calculating the start and expiery dates.
            ValidityInterval validityInterval = pkb.getValidityInterval();
            Date[] adjustedInterval;
            if (validityInterval != null) {
                adjustedInterval = getAdjustedValidityInterval(validityInterval
                        .getNotBefore(), validityInterval.getOnOrAfter());
            } else {
                adjustedInterval = getAdjustedValidityInterval((Date) null,
                        (Date) null);
            }

            long serialNum = nextSerialNumber();
            String aliase = createAlias(serialNum);
            BigInteger serialNumber = BigInteger.valueOf(serialNum);

            X509Certificate cert;

            List keyUsage = pkb.getKeyUsage();
            if (keyUsage == null
                    || keyUsage.isEmpty()
                    || (keyUsage.size() == 1 && keyUsage
                            .contains(KeyUsage.EXCHANGE))) {
                cert = XKMSKeyUtil.getX509Certificate(identifer, serialNumber,
View Full Code Here

Examples of org.wso2.xkms2.PrototypeKeyBinding

    private void validate(RegisterRequest registerRequest) throws XKMSException {

        validate((KRSSRequest) registerRequest);

        PrototypeKeyBinding pkb = registerRequest.getPrototypeKeyBinding();
        XMLSignature proofOfPossession = registerRequest.getProofOfPossession();

        Key key = pkb.getKeyValue();

        if (key != null) {
            try {
                proofOfPossession.checkSignatureValue(key);
View Full Code Here

Examples of org.wso2.xkms2.PrototypeKeyBinding

        return registerRequest;
    }

    private void processPrototypeKeyBinding(OMElement prototypeKeyBindingElem)
            throws XKMSException {
        PrototypeKeyBinding prototypeKeyBinding = (PrototypeKeyBinding) PrototypeKeyBindingBuilder.INSTANCE
                .buildElement(prototypeKeyBindingElem);
        registerRequest.setPrototypeKeyBinding(prototypeKeyBinding);

    }
View Full Code Here

Examples of org.wso2.xkms2.PrototypeKeyBinding

        Authentication authentication = registerRequest.getAuthentication();
        XMLSignature keyBindingAuthentication = authentication
                .getKeyBindingAuthentication();
        assertTrue(keyBindingAuthentication.checkSignatureValue(authKey));

        PrototypeKeyBinding prototypeKeyBinding = registerRequest
                .getPrototypeKeyBinding();
        KeyInfo keyInfo = prototypeKeyBinding.getKeyInfo();
        PublicKey publicKey = keyInfo.getPublicKey();
        XMLSignature proofOfPossession = registerRequest.getProofOfPossession();
        assertTrue(proofOfPossession.checkSignatureValue(publicKey));
    }
View Full Code Here

Examples of org.wso2.xkms2.PrototypeKeyBinding

        Authentication authentication = new Authentication();
        return authentication;
    }
   
    public static PrototypeKeyBinding createPrototypeKeyBinding() {
        PrototypeKeyBinding keyBinding = new PrototypeKeyBinding();
        keyBinding.setId(XKMSUtil.getRamdomId());
        return keyBinding;
    }
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.