2 * Copyright 2006 The Apache Software Foundation.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 * XSECCryptoX509CRL.cpp
20 * Wrapper for X.509 CRL objects, similar to existing XSEC wrappers.
24 #include "security/XSECCryptoX509CRL.h"
26 #include <xsec/framework/XSECError.hpp>
27 #include <xsec/enc/XSECCryptoException.hpp>
29 using namespace xmltooling;
31 void XSECCryptoX509CRL::loadX509CRLPEM(const char* buf, unsigned int len)
38 XSECnew(b1, char[len+1]);
44 const char *p = strstr(buf, "-----BEGIN X509 CRL-----");
51 throw XSECCryptoException(XSECCryptoException::X509Error,
52 "X509CRL::loadX509CRLPEM - Cannot find start of PEM CRL");
56 p += strlen("-----BEGIN X509 CRL-----");
58 while (*p == '\n' || *p == '\r' || *p == '-')
63 while (*p != '\0' && *p != '-') {
68 if (strstr(p, "-----END X509 CRL-----") != p) {
73 throw XSECCryptoException(XSECCryptoException::X509Error,
74 "X509CRL::loadX509PEMCRL - Cannot find end of PEM certificate");
83 this->loadX509CRLBase64Bin(output.rawCharBuffer(), i);