本文整理汇总了Java中org.apache.xml.security.exceptions.Base64DecodingException类的典型用法代码示例。如果您正苦于以下问题:Java Base64DecodingException类的具体用法?Java Base64DecodingException怎么用?Java Base64DecodingException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Base64DecodingException类属于org.apache.xml.security.exceptions包,在下文中一共展示了Base64DecodingException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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());
}
示例2: 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));
}
示例3: 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);
}
示例4: 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));
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
}
示例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");
}
示例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()
);
}
示例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);
}
示例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");
}
}
示例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;
}
示例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();
}
}
示例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());
}