XRootD
Loading...
Searching...
No Matches
XrdCryptosslgsiAux.cc File Reference
#include <cstring>
#include <sys/types.h>
#include <sys/stat.h>
#include <openssl/asn1.h>
#include <openssl/asn1t.h>
#include <openssl/err.h>
#include <openssl/evp.h>
#include <openssl/pem.h>
#include <openssl/rsa.h>
#include <openssl/x509v3.h>
#include <memory>
#include "XrdSut/XrdSutRndm.hh"
#include "XrdCrypto/XrdCryptogsiX509Chain.hh"
#include "XrdCrypto/XrdCryptosslAux.hh"
#include "XrdCrypto/XrdCryptosslRSA.hh"
#include "XrdCrypto/XrdCryptosslTrace.hh"
#include "XrdCrypto/XrdCryptosslX509.hh"
#include "XrdCrypto/XrdCryptosslX509Req.hh"
Include dependency graph for XrdCryptosslgsiAux.cc:

Go to the source code of this file.

Macros

#define BIO_GET_STRING(b, str)
#define BIO_PRINT(b, c)
#define KEY_USAGE_OID   "2.5.29.15"
#define SUBJ_ALT_NAME_OID   "2.5.29.17"
#define XRDGSI_VOMS_ACSEQ_OID   "1.3.6.1.4.1.8005.100.100.5"
#define XRDGSI_VOMS_ATCAP_OID   "1.3.6.1.4.1.8005.100.100.4"

Typedefs

using EVP_PKEY_ptr = std::unique_ptr<EVP_PKEY, decltype(&EVP_PKEY_free)>
using PROXY_CERT_INFO_EXTENSION_ptr = std::unique_ptr<PROXY_CERT_INFO_EXTENSION, decltype(&PROXY_CERT_INFO_EXTENSION_free)>
using STACK_OF_X509_EXTENSION_ptr = std::unique_ptr<STACK_OF(X509_EXTENSION), decltype(&stackOfX509ExtensionDelete)>
using X509_EXTENSION_ptr = std::unique_ptr<X509_EXTENSION, decltype(&X509_EXTENSION_free)>
using X509_NAME_ptr = std::unique_ptr<X509_NAME, decltype(&X509_NAME_free)>
using X509_ptr = std::unique_ptr<X509, decltype(&X509_free)>
using X509_REQ_ptr = std::unique_ptr<X509_REQ, decltype(&X509_REQ_free)>

Functions

static void stackOfX509ExtensionDelete (STACK_OF(X509_EXTENSION) *ske)
static int XrdCheckRSA (EVP_PKEY *pkey)
int XrdCryptosslX509Asn1PrintInfo (int tag, int xclass, int constructed, int indent)
int XrdCryptosslX509FillUnknownExt (const unsigned char **pp, long length)
int XrdCryptosslX509FillVOMS (const unsigned char **pp, long length, bool &getvat, XrdOucString &vat)

Macro Definition Documentation

◆ BIO_GET_STRING

#define BIO_GET_STRING ( b,
str )
Value:
BUF_MEM *bptr; \
BIO_get_mem_ptr(b, &bptr); \
if (bptr) { \
char *s = new char[bptr->length+1]; \
memcpy(s, bptr->data, bptr->length); \
s[bptr->length] = '\0'; \
str = s; \
delete [] s; \
} else { \
PRINT("ERROR: GET_STRING: BIO internal buffer undefined!"); \
} \
if (b) BIO_free(b);

Definition at line 105 of file XrdCryptosslgsiAux.cc.

105#define BIO_GET_STRING(b,str) \
106 BUF_MEM *bptr; \
107 BIO_get_mem_ptr(b, &bptr); \
108 if (bptr) { \
109 char *s = new char[bptr->length+1]; \
110 memcpy(s, bptr->data, bptr->length); \
111 s[bptr->length] = '\0'; \
112 str = s; \
113 delete [] s; \
114 } else { \
115 PRINT("ERROR: GET_STRING: BIO internal buffer undefined!"); \
116 } \
117 if (b) BIO_free(b);

◆ BIO_PRINT

#define BIO_PRINT ( b,
c )
Value:
BUF_MEM *bptr; \
BIO_get_mem_ptr(b, &bptr); \
if (bptr) { \
char *s = new char[bptr->length+1]; \
memcpy(s, bptr->data, bptr->length); \
s[bptr->length] = '\0'; \
PRINT(c << s); \
delete [] s; \
} else { \
PRINT("ERROR: "<<c<<" BIO internal buffer undefined!"); \
} \
if (b) BIO_free(b);

Definition at line 91 of file XrdCryptosslgsiAux.cc.

91#define BIO_PRINT(b,c) \
92 BUF_MEM *bptr; \
93 BIO_get_mem_ptr(b, &bptr); \
94 if (bptr) { \
95 char *s = new char[bptr->length+1]; \
96 memcpy(s, bptr->data, bptr->length); \
97 s[bptr->length] = '\0'; \
98 PRINT(c << s); \
99 delete [] s; \
100 } else { \
101 PRINT("ERROR: "<<c<<" BIO internal buffer undefined!"); \
102 } \
103 if (b) BIO_free(b);

◆ KEY_USAGE_OID

#define KEY_USAGE_OID   "2.5.29.15"

Definition at line 78 of file XrdCryptosslgsiAux.cc.

◆ SUBJ_ALT_NAME_OID

#define SUBJ_ALT_NAME_OID   "2.5.29.17"

Definition at line 80 of file XrdCryptosslgsiAux.cc.

◆ XRDGSI_VOMS_ACSEQ_OID

#define XRDGSI_VOMS_ACSEQ_OID   "1.3.6.1.4.1.8005.100.100.5"

Definition at line 89 of file XrdCryptosslgsiAux.cc.

◆ XRDGSI_VOMS_ATCAP_OID

#define XRDGSI_VOMS_ATCAP_OID   "1.3.6.1.4.1.8005.100.100.4"

Definition at line 88 of file XrdCryptosslgsiAux.cc.

Typedef Documentation

◆ EVP_PKEY_ptr

using EVP_PKEY_ptr = std::unique_ptr<EVP_PKEY, decltype(&EVP_PKEY_free)>

Definition at line 63 of file XrdCryptosslgsiAux.cc.

◆ PROXY_CERT_INFO_EXTENSION_ptr

using PROXY_CERT_INFO_EXTENSION_ptr = std::unique_ptr<PROXY_CERT_INFO_EXTENSION, decltype(&PROXY_CERT_INFO_EXTENSION_free)>

Definition at line 68 of file XrdCryptosslgsiAux.cc.

◆ STACK_OF_X509_EXTENSION_ptr

using STACK_OF_X509_EXTENSION_ptr = std::unique_ptr<STACK_OF(X509_EXTENSION), decltype(&stackOfX509ExtensionDelete)>

Definition at line 69 of file XrdCryptosslgsiAux.cc.

◆ X509_EXTENSION_ptr

using X509_EXTENSION_ptr = std::unique_ptr<X509_EXTENSION, decltype(&X509_EXTENSION_free)>

Definition at line 67 of file XrdCryptosslgsiAux.cc.

◆ X509_NAME_ptr

using X509_NAME_ptr = std::unique_ptr<X509_NAME, decltype(&X509_NAME_free)>

Definition at line 65 of file XrdCryptosslgsiAux.cc.

◆ X509_ptr

using X509_ptr = std::unique_ptr<X509, decltype(&X509_free)>

Definition at line 64 of file XrdCryptosslgsiAux.cc.

◆ X509_REQ_ptr

using X509_REQ_ptr = std::unique_ptr<X509_REQ, decltype(&X509_REQ_free)>

Definition at line 66 of file XrdCryptosslgsiAux.cc.

Function Documentation

◆ stackOfX509ExtensionDelete()

void stackOfX509ExtensionDelete ( STACK_OF(X509_EXTENSION) * ske)
static

Definition at line 60 of file XrdCryptosslgsiAux.cc.

60 {
61 sk_X509_EXTENSION_pop_free(ske, X509_EXTENSION_free);
62}

◆ XrdCheckRSA()

int XrdCheckRSA ( EVP_PKEY * pkey)
static

Definition at line 119 of file XrdCryptosslgsiAux.cc.

119 {
120 int rc;
121 EVP_PKEY_CTX *ckctx = EVP_PKEY_CTX_new(pkey, 0);
122 rc = EVP_PKEY_check(ckctx);
123 EVP_PKEY_CTX_free(ckctx);
124 return rc;
125}

Referenced by XrdCryptosslRSA::XrdCryptosslRSA(), XrdCryptosslRSA::XrdCryptosslRSA(), and XrdCryptosslRSA::XrdCryptosslRSA().

Here is the caller graph for this function:

◆ XrdCryptosslX509Asn1PrintInfo()

int XrdCryptosslX509Asn1PrintInfo ( int tag,
int xclass,
int constructed,
int indent )

◆ XrdCryptosslX509FillUnknownExt()

int XrdCryptosslX509FillUnknownExt ( const unsigned char ** pp,
long length )

◆ XrdCryptosslX509FillVOMS()

int XrdCryptosslX509FillVOMS ( const unsigned char ** pp,
long length,
bool & getvat,
XrdOucString & vat )