2 * Licensed to the University Corporation for Advanced Internet
3 * Development, Inc. (UCAID) under one or more contributor license
4 * agreements. See the NOTICE file distributed with this work for
5 * additional information regarding copyright ownership.
7 * UCAID licenses this file to you under the Apache License,
8 * Version 2.0 (the "License"); you may not use this file except
9 * in compliance with the License. You may obtain a copy of the
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
17 * either express or implied. See the License for the specific
18 * language governing permissions and limitations under the License.
22 * XSECCryptoX509CRL.cpp
24 * Wrapper for X.509 CRL objects, similar to existing XSEC wrappers.
28 #include "security/XSECCryptoX509CRL.h"
30 #include <xsec/framework/XSECError.hpp>
31 #include <xsec/enc/XSECCryptoException.hpp>
33 using namespace xmltooling;
35 XSECCryptoX509CRL::XSECCryptoX509CRL()
39 XSECCryptoX509CRL::~XSECCryptoX509CRL()
43 void XSECCryptoX509CRL::loadX509CRLPEM(const char* buf, unsigned int len)
50 XSECnew(b1, char[len+1]);
56 const char *p = strstr(buf, "-----BEGIN X509 CRL-----");
63 throw XSECCryptoException(XSECCryptoException::X509Error,
64 "X509CRL::loadX509CRLPEM - Cannot find start of PEM CRL");
68 p += strlen("-----BEGIN X509 CRL-----");
70 while (*p == '\n' || *p == '\r' || *p == '-')
75 while (*p != '\0' && *p != '-') {
80 if (strstr(p, "-----END X509 CRL-----") != p) {
85 throw XSECCryptoException(XSECCryptoException::X509Error,
86 "X509CRL::loadX509PEMCRL - Cannot find end of PEM certificate");
95 this->loadX509CRLBase64Bin(output.rawCharBuffer(), i);