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