• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Base64DecodingException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.xml.security.exceptions.Base64DecodingException的典型用法代码示例。如果您正苦于以下问题:Java Base64DecodingException类的具体用法?Java Base64DecodingException怎么用?Java Base64DecodingException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Base64DecodingException类属于org.apache.xml.security.exceptions包,在下文中一共展示了Base64DecodingException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: decode

import org.apache.xml.security.exceptions.Base64DecodingException; //导入依赖的package包/类
/**
 * Method decode
 *
 * Takes the <CODE>Text</CODE> children of the Element and interprets
 * them as input for the <CODE>Base64.decode()</CODE> function.
 *
 * @param element
 * @return the byte obtained of the decoding the element
 * $todo$ not tested yet
 * @throws Base64DecodingException
 */
public static final byte[] decode(Element element) throws Base64DecodingException {

    Node sibling = element.getFirstChild();
    StringBuilder sb = new StringBuilder();

    while (sibling != null) {
        if (sibling.getNodeType() == Node.TEXT_NODE) {
            Text t = (Text) sibling;

            sb.append(t.getData());
        }
        sibling = sibling.getNextSibling();
    }

    return decode(sb.toString());
}
 
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:28,代码来源:Base64.java


示例2: getKeyStore

import org.apache.xml.security.exceptions.Base64DecodingException; //导入依赖的package包/类
private static IdaKeyStore getKeyStore() throws Base64DecodingException {
    List<KeyPair> encryptionKeyPairs = new ArrayList<>();
    PublicKeyFactory publicKeyFactory = new PublicKeyFactory(new X509CertificateFactory());
    PrivateKeyFactory privateKeyFactory = new PrivateKeyFactory();
    PublicKey encryptionPublicKey = publicKeyFactory.createPublicKey(HUB_TEST_PUBLIC_ENCRYPTION_CERT);
    PrivateKey encryptionPrivateKey = privateKeyFactory.createPrivateKey(Base64.getDecoder().decode(HUB_TEST_PRIVATE_ENCRYPTION_KEY.getBytes()));
    encryptionKeyPairs.add(new KeyPair(encryptionPublicKey, encryptionPrivateKey));
    PublicKey publicSigningKey = publicKeyFactory.createPublicKey(HUB_TEST_PUBLIC_SIGNING_CERT);
    PrivateKey privateSigningKey = privateKeyFactory.createPrivateKey(Base64.getDecoder().decode(HUB_TEST_PRIVATE_SIGNING_KEY.getBytes()));
    KeyPair signingKeyPair = new KeyPair(publicSigningKey, privateSigningKey);

    return new IdaKeyStore(signingKeyPair, encryptionKeyPairs);
}
 
开发者ID:alphagov,项目名称:verify-hub,代码行数:14,代码来源:SamlMessageSenderApiResourceTest.java


示例3: anUnhealthyHealthCheckResponse

import org.apache.xml.security.exceptions.Base64DecodingException; //导入依赖的package包/类
private String anUnhealthyHealthCheckResponse(String msaEntityId) throws Base64DecodingException {
    Function<HealthCheckResponseFromMatchingService, Element> transformer = new MsaTransformersFactory().getHealthcheckResponseFromMatchingServiceToElementTransformer(
            null,
            getKeyStore(),
            s -> "who-knows",
            SIGNATURE_ALGORITHM,
            DIGEST_ALGORITHM
    );
    final HealthCheckResponseFromMatchingService healthCheckResponse = new HealthCheckResponseFromMatchingService(
            msaEntityId,
            "request-id"
    );
    final Element healthyResponse = transformer.apply(healthCheckResponse);
    return XmlUtils.writeToString(soapMessageManager.wrapWithSoapEnvelope(healthyResponse));
}
 
开发者ID:alphagov,项目名称:verify-hub,代码行数:16,代码来源:MatchingServiceHealthCheckIntegrationTests.java


示例4: aHealthyHealthCheckResponse

import org.apache.xml.security.exceptions.Base64DecodingException; //导入依赖的package包/类
private String aHealthyHealthCheckResponse(String msaEntityId) throws Base64DecodingException {
    Function<uk.gov.ida.saml.msa.test.outbound.HealthCheckResponseFromMatchingService, Element> transformer = new MsaTransformersFactory().getHealthcheckResponseFromMatchingServiceToElementTransformer(
            null,
            getKeyStore(),
            s -> HUB_ENTITY_ID,
            SIGNATURE_ALGORITHM,
            DIGEST_ALGORITHM
    );
    final HealthCheckResponseFromMatchingService healthCheckResponse = new HealthCheckResponseFromMatchingService(
            msaEntityId,
            "request-id"
    );
    final Element healthyResponse = transformer.apply(healthCheckResponse);
    return XmlUtils.writeToString(soapMessageManager.wrapWithSoapEnvelope(healthyResponse));
}
 
开发者ID:alphagov,项目名称:verify-hub,代码行数:16,代码来源:MatchingServiceHealthCheckIntegrationTests.java


示例5: getKeyStore

import org.apache.xml.security.exceptions.Base64DecodingException; //导入依赖的package包/类
private IdaKeyStore getKeyStore() throws Base64DecodingException {
    List<KeyPair> encryptionKeyPairs = new ArrayList<>();
    PublicKeyFactory publicKeyFactory = new PublicKeyFactory(new X509CertificateFactory());
    PrivateKeyFactory privateKeyFactory = new PrivateKeyFactory();
    PublicKey encryptionPublicKey = publicKeyFactory.createPublicKey(HUB_TEST_PUBLIC_ENCRYPTION_CERT);
    PrivateKey encryptionPrivateKey = privateKeyFactory.createPrivateKey(Base64.getDecoder().decode(HUB_TEST_PRIVATE_ENCRYPTION_KEY.getBytes()));
    encryptionKeyPairs.add(new KeyPair(encryptionPublicKey, encryptionPrivateKey));
    PublicKey publicSigningKey = publicKeyFactory.createPublicKey(HUB_TEST_PUBLIC_SIGNING_CERT);
    PrivateKey privateSigningKey = privateKeyFactory.createPrivateKey(Base64.getDecoder().decode(HUB_TEST_PRIVATE_SIGNING_KEY.getBytes()));
    KeyPair signingKeyPair = new KeyPair(publicSigningKey, privateSigningKey);

    return new IdaKeyStore(signingKeyPair, encryptionKeyPairs);
}
 
开发者ID:alphagov,项目名称:verify-hub,代码行数:14,代码来源:MatchingServiceHealthCheckIntegrationTests.java


示例6: DOMX509Data

import org.apache.xml.security.exceptions.Base64DecodingException; //导入依赖的package包/类
/**
 * Creates a <code>DOMX509Data</code> from an element.
 *
 * @param xdElem an X509Data element
 * @throws MarshalException if there is an error while unmarshalling
 */
public DOMX509Data(Element xdElem) throws MarshalException {
    // get all children nodes
    List<Object> newContent = new ArrayList<Object>();
    Node firstChild = xdElem.getFirstChild();
    while (firstChild != null) {
        if (firstChild.getNodeType() == Node.ELEMENT_NODE) {
            Element childElem = (Element)firstChild;
            String localName = childElem.getLocalName();
            String namespace = childElem.getNamespaceURI();
            if (localName.equals("X509Certificate") && XMLSignature.XMLNS.equals(namespace)) {
                newContent.add(unmarshalX509Certificate(childElem));
            } else if (localName.equals("X509IssuerSerial") && XMLSignature.XMLNS.equals(namespace)) {
                newContent.add(new DOMX509IssuerSerial(childElem));
            } else if (localName.equals("X509SubjectName") && XMLSignature.XMLNS.equals(namespace)) {
                newContent.add(childElem.getFirstChild().getNodeValue());
            } else if (localName.equals("X509SKI") && XMLSignature.XMLNS.equals(namespace)) {
                try {
                    newContent.add(Base64.decode(childElem));
                } catch (Base64DecodingException bde) {
                    throw new MarshalException("cannot decode X509SKI", bde);
                }
            } else if (localName.equals("X509CRL") && XMLSignature.XMLNS.equals(namespace)) {
                newContent.add(unmarshalX509CRL(childElem));
            } else {
                newContent.add(new javax.xml.crypto.dom.DOMStructure(childElem));
            }
        }
        firstChild = firstChild.getNextSibling();
    }
    this.content = Collections.unmodifiableList(newContent);
}
 
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:38,代码来源:DOMX509Data.java


示例7: unmarshalBase64Binary

import org.apache.xml.security.exceptions.Base64DecodingException; //导入依赖的package包/类
private ByteArrayInputStream unmarshalBase64Binary(Element elem)
    throws MarshalException {
    try {
        if (cf == null) {
            cf = CertificateFactory.getInstance("X.509");
        }
        return new ByteArrayInputStream(Base64.decode(elem));
    } catch (CertificateException e) {
        throw new MarshalException("Cannot create CertificateFactory", e);
    } catch (Base64DecodingException bde) {
        throw new MarshalException("Cannot decode Base64-encoded val", bde);
    }
}
 
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:14,代码来源:DOMX509Data.java


示例8: DOMPGPData

import org.apache.xml.security.exceptions.Base64DecodingException; //导入依赖的package包/类
/**
 * Creates a <code>DOMPGPData</code> from an element.
 *
 * @param pdElem a PGPData element
 */
public DOMPGPData(Element pdElem) throws MarshalException {
    // get all children nodes
    byte[] pgpKeyId = null;
    byte[] pgpKeyPacket = null;

    List<XMLStructure> other = new ArrayList<XMLStructure>();
    Node firstChild = pdElem.getFirstChild();
    while (firstChild != null) {
        if (firstChild.getNodeType() == Node.ELEMENT_NODE) {
            Element childElem = (Element)firstChild;
            String localName = childElem.getLocalName();
            String namespace = childElem.getNamespaceURI();
            try {
                if (localName.equals("PGPKeyID") && XMLSignature.XMLNS.equals(namespace)) {
                    pgpKeyId = Base64.decode(childElem);
                } else if (localName.equals("PGPKeyPacket") && XMLSignature.XMLNS.equals(namespace)) {
                    pgpKeyPacket = Base64.decode(childElem);
                } else {
                    other.add
                        (new javax.xml.crypto.dom.DOMStructure(childElem));
                }
            } catch (Base64DecodingException bde) {
                throw new MarshalException(bde);
            }
        }
        firstChild = firstChild.getNextSibling();
    }
    this.keyId = pgpKeyId;
    this.keyPacket = pgpKeyPacket;
    this.externalElements = Collections.unmodifiableList(other);
}
 
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:37,代码来源:DOMPGPData.java


示例9: DOMSignatureValue

import org.apache.xml.security.exceptions.Base64DecodingException; //导入依赖的package包/类
DOMSignatureValue(Element sigValueElem)
    throws MarshalException
{
    try {
        // base64 decode signatureValue
        value = Base64.decode(sigValueElem);
    } catch (Base64DecodingException bde) {
        throw new MarshalException(bde);
    }

    id = DOMUtils.getIdAttributeValue(sigValueElem, "Id");
}
 
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:13,代码来源:DOMXMLSignature.java


示例10: getBigIntegerFromChildElement

import org.apache.xml.security.exceptions.Base64DecodingException; //导入依赖的package包/类
/**
 * Method getVal
 *
 * @param localname
 * @param namespace
 * @return The biginteger contained in the given element
 * @throws Base64DecodingException
 */
public BigInteger getBigIntegerFromChildElement(
    String localname, String namespace
) throws Base64DecodingException {
    return Base64.decodeBigIntegerFromString(
        XMLUtils.selectNodeText(
            getFirstChild(), namespace, localname, 0
        ).getNodeValue()
    );
}
 
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:18,代码来源:ElementProxy.java


示例11: getDigestValue

import org.apache.xml.security.exceptions.Base64DecodingException; //导入依赖的package包/类
/**
 * Returns the digest value.
 *
 * @return the digest value.
 * @throws Base64DecodingException if Reference contains no proper base64 encoded data.
 * @throws XMLSecurityException if the Reference does not contain a DigestValue element
 */
public byte[] getDigestValue() throws Base64DecodingException, XMLSecurityException {
    if (digestValueElement == null) {
        // The required element is not in the XML!
        Object[] exArgs ={ Constants._TAG_DIGESTVALUE, Constants.SignatureSpecNS };
        throw new XMLSecurityException(
            "signature.Verification.NoSignatureElement", exArgs
        );
    }
    return Base64.decode(digestValueElement);
}
 
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:18,代码来源:Reference.java


示例12: getSignatureValue

import org.apache.xml.security.exceptions.Base64DecodingException; //导入依赖的package包/类
/**
 * Returns the octet value of the SignatureValue element.
 * Throws an XMLSignatureException if it has no or wrong content.
 *
 * @return the value of the SignatureValue element.
 * @throws XMLSignatureException If there is no content
 */
public byte[] getSignatureValue() throws XMLSignatureException {
    try {
        return Base64.decode(signatureValueElement);
    } catch (Base64DecodingException ex) {
        throw new XMLSignatureException(ex, "empty");
    }
}
 
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:15,代码来源:XMLSignature.java


示例13: convertXmlEncToEncryptedDate

import org.apache.xml.security.exceptions.Base64DecodingException; //导入依赖的package包/类
private EncryptedDataType convertXmlEncToEncryptedDate(Element eEncryptedData) {
   	EncryptedDataType encryptedDataType = new EncryptedDataType();
   	Element eEncryptionMethod = DOMUtil.getChildElement(eEncryptedData, F_XML_ENC_ENCRYPTION_METHOD);
   	if (eEncryptionMethod != null) {
   		String algorithm = eEncryptionMethod.getAttribute(ATTRIBUTE_XML_ENC_ALGORITHM);
   		EncryptionMethodType encryptionMethodType = new EncryptionMethodType();
   		encryptionMethodType.setAlgorithm(algorithm);
		encryptedDataType.setEncryptionMethod(encryptionMethodType);
   	}
   	Element eKeyInfo = DOMUtil.getChildElement(eEncryptedData, F_XML_DSIG_KEY_INFO);
   	if (eKeyInfo != null) {
   		KeyInfoType keyInfoType = new KeyInfoType();
   		encryptedDataType.setKeyInfo(keyInfoType);
   		Element eKeyName = DOMUtil.getChildElement(eKeyInfo, F_XML_DSIG_KEY_NAME);
		if (eKeyName != null) {
			keyInfoType.setKeyName(eKeyName.getTextContent());
		}
   	}
   	Element eCipherData = DOMUtil.getChildElement(eEncryptedData, F_XML_ENC_CIPHER_DATA);
   	if (eCipherData != null) {
   		CipherDataType cipherDataType = new CipherDataType();
		encryptedDataType.setCipherData(cipherDataType);
		Element eCipherValue = DOMUtil.getChildElement(eCipherData, F_XML_ENC_CIPHER_VALUE);
		if (eCipherValue != null) {
			String cipherValue = eCipherValue.getTextContent();
			byte[] cipherValueBytes;
			try {
				cipherValueBytes = Base64.decode(cipherValue);
			} catch (Base64DecodingException e) {
				throw new IllegalArgumentException("Bad base64 encoding in CipherValue element: "+e.getMessage(),e);
			}
			cipherDataType.setCipherValue(cipherValueBytes);
		}
   	}
   	return encryptedDataType;
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:37,代码来源:ProtectedDataType.java


示例14: decompress

import org.apache.xml.security.exceptions.Base64DecodingException; //导入依赖的package包/类
private void decompress(String sessionName, String stream) throws IOException {
	try {
		byte[] bytes = Base64.decode(stream);
	} catch (Base64DecodingException e) {
		e.printStackTrace();
	}

}
 
开发者ID:mnikliborc,项目名称:clicktrace,代码行数:9,代码来源:JiraRestClicktraceImportMock.java


示例15: fillFormValues

import org.apache.xml.security.exceptions.Base64DecodingException; //导入依赖的package包/类
public static void fillFormValues(EctConsultationFormRequestForm thisForm, String segmentId) throws HL7Exception, UnsupportedEncodingException, Base64DecodingException
	{
		Hl7TextMessageDao hl7TextMessageDao=(Hl7TextMessageDao) SpringUtils.getBean("hl7TextMessageDao");
		Hl7TextMessage hl7TextMessage=hl7TextMessageDao.find(Integer.parseInt(segmentId));
		
		String encodedMessage=hl7TextMessage.getBase64EncodedeMessage();
		byte[] decodedMessage=Base64.decode(encodedMessage);
		String decodedMessageString=new String(decodedMessage, MiscUtils.DEFAULT_UTF8_ENCODING);
		
		REF_I12 refI12=(REF_I12) OscarToOscarUtils.pipeParserParse(decodedMessageString);
		
		thisForm.setHl7TextMessageId(hl7TextMessage.getId());
		
        thisForm.setAllergies(RefI12.getNteValue(refI12, RefI12.REF_NTE_TYPE.ALLERGIES));
        thisForm.setReasonForConsultation(RefI12.getNteValue(refI12, RefI12.REF_NTE_TYPE.REASON_FOR_CONSULTATION));
        thisForm.setClinicalInformation(RefI12.getNteValue(refI12, RefI12.REF_NTE_TYPE.CLINICAL_INFORMATION));
        thisForm.setCurrentMedications(RefI12.getNteValue(refI12, RefI12.REF_NTE_TYPE.CURRENT_MEDICATIONS));
        
        GregorianCalendar referralDate=DataTypeUtils.getCalendarFromDTM(refI12.getRF1().getEffectiveDate());
        thisForm.setReferalDate(DateFormatUtils.ISO_DATE_FORMAT.format(referralDate));

        thisForm.setConcurrentProblems(RefI12.getNteValue(refI12, RefI12.REF_NTE_TYPE.CONCURRENT_PROBLEMS));

        // spoecifically told that this field should not be sent electronically (so it shouldn't be received either).
        // thisForm.setAppointmentNotes(RefI12.getNteValue(refI12, RefI12.REF_NTE_TYPE.APPOINTMENT_NOTES));

        //---
        
        
        PID pid=refI12.getPID();
        Demographic demographic=DataTypeUtils.parsePid(pid);
        
        StringBuilder address=new StringBuilder();
        if (demographic.getAddress()!=null) address.append(demographic.getAddress()).append("<br />");
        if (demographic.getCity()!=null) address.append(demographic.getCity()).append(", ");
        if (demographic.getProvince()!=null) address.append(demographic.getProvince());
        thisForm.setPatientAddress(address.toString());

        if (demographic.getBirthDay()!=null)
        {
	        thisForm.setPatientDOB(DateFormatUtils.ISO_DATE_FORMAT.format(demographic.getBirthDay()));
	        String ageString=UtilDateUtilities.calcAgeAtDate(demographic.getBirthDay().getTime(), new Date());
	        thisForm.setPatientAge(ageString);
        }
        
        thisForm.setPatientHealthNum(demographic.getHin());
        thisForm.setPatientHealthCardType(demographic.getHcType());
        thisForm.setPatientHealthCardVersionCode(demographic.getVer());
        
        thisForm.setPatientFirstName(demographic.getFirstName());
        thisForm.setPatientLastName(demographic.getLastName());
        thisForm.setPatientPhone(demographic.getPhone());
        thisForm.setPatientSex(demographic.getSex());
//        thisForm.setPatientWPhone(patientAddress);
        thisForm.setPatientEmail(demographic.getEmail());
        
        // referring provider
        PRD referringPrd=RefI12.getPrdByRoleId(refI12, "RP");
        Provider provider=DataTypeUtils.parsePrdAsProvider(referringPrd);
        thisForm.setProviderName(provider.getLastName()+", "+provider.getFirstName());

        thisForm.seteReferral(true);

        // referredTo specialist
        PRD referredToPrd=RefI12.getPrdByRoleId(refI12, "RT");
        ProfessionalSpecialist professionalSpecialist=DataTypeUtils.parsePrdAsProfessionalSpecialist(referredToPrd);
        thisForm.setProfessionalSpecialistName(professionalSpecialist.getLastName()+", "+professionalSpecialist.getFirstName());
        thisForm.setProfessionalSpecialistAddress(professionalSpecialist.getStreetAddress());
        thisForm.setProfessionalSpecialistPhone(professionalSpecialist.getPhoneNumber());

	}
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:72,代码来源:EctViewRequestAction.java


示例16: unmarshalKeyValue

import org.apache.xml.security.exceptions.Base64DecodingException; //导入依赖的package包/类
@Override
ECPublicKey unmarshalKeyValue(Element kvtElem)
    throws MarshalException
{
    if (eckf == null) {
        try {
            eckf = KeyFactory.getInstance("EC");
        } catch (NoSuchAlgorithmException e) {
            throw new RuntimeException
                ("unable to create EC KeyFactory: " + e.getMessage());
        }
    }
    ECParameterSpec ecParams = null;
    Element curElem = DOMUtils.getFirstChildElement(kvtElem);
    if (curElem == null) {
        throw new MarshalException("KeyValue must contain at least one type");
    }

    if (curElem.getLocalName().equals("ECParameters")
        && XMLDSIG_11_XMLNS.equals(curElem.getNamespaceURI())) {
        throw new UnsupportedOperationException
            ("ECParameters not supported");
    } else if (curElem.getLocalName().equals("NamedCurve")
        && XMLDSIG_11_XMLNS.equals(curElem.getNamespaceURI())) {
        String uri = DOMUtils.getAttributeValue(curElem, "URI");
        // strip off "urn:oid"
        if (uri.startsWith("urn:oid:")) {
            String oid = uri.substring("urn:oid:".length());
            ecParams = getECParameterSpec(oid);
            if (ecParams == null) {
                throw new MarshalException("Invalid curve OID");
            }
        } else {
            throw new MarshalException("Invalid NamedCurve URI");
        }
    } else {
        throw new MarshalException("Invalid ECKeyValue");
    }
    curElem = DOMUtils.getNextSiblingElement(curElem, "PublicKey", XMLDSIG_11_XMLNS);
    ECPoint ecPoint = null;

    try {
        ecPoint = decodePoint(Base64.decode(curElem),
                              ecParams.getCurve());
    } catch (Base64DecodingException bde) {
        throw new MarshalException("Invalid EC PublicKey", bde);
    } catch (IOException ioe) {
        throw new MarshalException("Invalid EC Point", ioe);
    }

    ECPublicKeySpec spec = new ECPublicKeySpec(ecPoint, ecParams);
    return (ECPublicKey) generatePublicKey(eckf, spec);
}
 
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:54,代码来源:DOMKeyValue.java


示例17: init

import org.apache.xml.security.exceptions.Base64DecodingException; //导入依赖的package包/类
public void init() throws Base64DecodingException, XMLSecurityException {
	generateDigestValue();
	LOG.debug("original digest: " + Base64.encode(getDigestValue()));
}
 
开发者ID:e-Contract,项目名称:eid-applet,代码行数:5,代码来源:AbstractXmlSignatureServiceTest.java


示例18: importMetaData

import org.apache.xml.security.exceptions.Base64DecodingException; //导入依赖的package包/类
private static void importMetaData(Options options, CommandLine cmd,
		String unisonXMLFile, TremoloType ttRead, TremoloType ttWrite, String ksPath, KeyStore ks)
		throws Exception, Base64DecodingException, CertificateException,
		KeyStoreException, IOException, NoSuchAlgorithmException,
		FileNotFoundException, JAXBException, PropertyException {
	logger.info("Finding mechanism...");
	String mechanismName = loadOption(cmd,"mechanismName",options);
	MechanismType saml2Mech = loadMechanismType(mechanismName,ttWrite);
	logger.info("...found");
	
	logger.info("Finding chain...");
	String chainName = loadOption(cmd,"chainName",options);
	
	AuthChainType act = loadChainType(chainName,ttWrite);
	
	
	boolean createDefault = cmd.hasOption("createDefault");
	logger.info("Create default configuration? : " + createDefault);
	
	logger.info("Loading metadata...");
	String pathToMetaData = loadOption(cmd,"pathToMetaData",options);
	logger.info("...loaded");
	EntityDescriptor ed = loadIdPMetaData(pathToMetaData,ks,ttRead);
	IDPSSODescriptor idp = ed.getIDPSSODescriptor("urn:oasis:names:tc:SAML:2.0:protocol");
	
	logger.info("Looking for correct mechanism on the chain...");
	AuthMechType currentMechanism = null;
	for (AuthMechType amt : act.getAuthMech()) {
		if (amt.getName().equalsIgnoreCase(mechanismName)) {
			currentMechanism = amt;
			break;
		}
	}
	
	boolean newMech = true;
	
	if (currentMechanism != null) {
		logger.info("Updating existing mechanism");
		newMech = false;
	} else {
		logger.info("Creating new mechanism");
		currentMechanism = new AuthMechType();
		currentMechanism.setName(mechanismName);
		currentMechanism.setRequired("required");
		currentMechanism.setParams(new AuthMechParamType());
		act.getAuthMech().add(currentMechanism);
		newMech = true;
	}
	
	HashMap<String,ParamType> params = new HashMap<String,ParamType>();
	for (ParamType pt : currentMechanism.getParams().getParam()) {
		params.put(pt.getName(), pt);
	}
	
	
	
	importMetaData(ks, ed, idp, currentMechanism, params);
	
	if (newMech && createDefault) {
		setDefaults(ks, ed, idp, currentMechanism, params);
	}
	
	storeMethod(unisonXMLFile, ttWrite, ksPath, ks);
}
 
开发者ID:TremoloSecurity,项目名称:OpenUnison,代码行数:65,代码来源:OpenUnisonUtils.java


示例19: accept

import org.apache.xml.security.exceptions.Base64DecodingException; //导入依赖的package包/类
/**
 *  Parse a Base-64 encoded buffer back into a SAML response and optionally test its
 *  validity against the POST profile<P>
 *
 *  The signature over the response is not verified or examined, nor is the
 *  identity of the signer. The replay cache is also not checked.
 *
 * @param  buf                A Base-64 encoded buffer containing a SAML
 *      response
 * @param  receiver           The URL of the intended consumer of the
 *      response
 * @param  ttlSeconds         Seconds allowed to lapse from the issuance of
 *      the response
 * @param  process            Process the response or just decode and parse it?
 * @return                    SAML response sent by origin site
 * @exception  SAMLException  Thrown if the response is invalid
 */
public static SAMLResponse accept(byte[] buf, String receiver, int ttlSeconds, boolean process)
    throws SAMLException
{
	
    try
    {
        SAMLResponse r = new SAMLResponse(new ByteArrayInputStream(Base64.decode(buf)));
        if (process)
            process(r, receiver, ttlSeconds);
        return r;
    }
    catch (Base64DecodingException e)
    {
        throw new InvalidAssertionException(SAMLException.REQUESTER, "SAMLPOSTProfile.accept() unable to decode base64 response");
    }
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:34,代码来源:SAMLPOSTProfile.java


示例20: importSecreyKey

import org.apache.xml.security.exceptions.Base64DecodingException; //导入依赖的package包/类
private static void importSecreyKey(Options options, CommandLine cmd, TremoloType tt, KeyStore ks, String ksPath) throws KeyStoreException, Base64DecodingException, NoSuchAlgorithmException, CertificateException, FileNotFoundException, IOException {
	String alias = loadOption(cmd,"alias",options);
	logger.info("importing to " + alias);
	String base64Key = loadOption(cmd,"secretkey",options);
	
	SecretKey sc = new SecretKeySpec(Base64.decode(base64Key),"AES");
	
	ks.setKeyEntry(alias, sc, tt.getKeyStorePassword().toCharArray(), null);
	ks.store(new FileOutputStream(ksPath), tt.getKeyStorePassword().toCharArray());
	
	
	logger.info("import complete");
	
}
 
开发者ID:TremoloSecurity,项目名称:OpenUnison,代码行数:15,代码来源:OpenUnisonUtils.java



注:本文中的org.apache.xml.security.exceptions.Base64DecodingException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java NamingResources类代码示例发布时间:2022-05-22
下一篇:
Java RollingRandomAccessFileAppender类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap