575 |
575 |
576 /* copy certsList */ |
576 /* copy certsList */ |
577 size = xmlSecSymbianCryptoKeyDataX509GetCertsSize(src); |
577 size = xmlSecSymbianCryptoKeyDataX509GetCertsSize(src); |
578 for(pos = 0; pos < size; ++pos) { |
578 for(pos = 0; pos < size; ++pos) { |
579 certSrc = xmlSecSymbianCryptoKeyDataX509GetCert(src, pos); |
579 certSrc = xmlSecSymbianCryptoKeyDataX509GetCert(src, pos); |
|
580 certDst = xmlSecSymbianCryptoKeyDataX509GetCert(dst, pos); |
580 if(!certSrc) { |
581 if(!certSrc) { |
581 xmlSecError(XMLSEC_ERRORS_HERE, |
582 xmlSecError(XMLSEC_ERRORS_HERE, |
582 xmlSecErrorsSafeString(xmlSecKeyDataGetName(src)), |
583 xmlSecErrorsSafeString(xmlSecKeyDataGetName(src)), |
583 "xmlSecSymbianCryptoKeyDataX509GetCert", |
584 "xmlSecSymbianCryptoKeyDataX509GetCert", |
584 XMLSEC_ERRORS_R_XMLSEC_FAILED, |
585 XMLSEC_ERRORS_R_XMLSEC_FAILED, |
608 |
609 |
609 /* copy crls */ |
610 /* copy crls */ |
610 size = xmlSecSymbianCryptoKeyDataX509GetCrlsSize(src); |
611 size = xmlSecSymbianCryptoKeyDataX509GetCrlsSize(src); |
611 for(pos = 0; pos < size; ++pos) { |
612 for(pos = 0; pos < size; ++pos) { |
612 crlSrc = xmlSecSymbianCryptoKeyDataX509GetCrl(src, pos); |
613 crlSrc = xmlSecSymbianCryptoKeyDataX509GetCrl(src, pos); |
|
614 crlDst =xmlSecSymbianCryptoKeyDataX509GetCrl(dst, pos); |
613 if(!crlSrc) { |
615 if(!crlSrc) { |
614 xmlSecError(XMLSEC_ERRORS_HERE, |
616 xmlSecError(XMLSEC_ERRORS_HERE, |
615 xmlSecErrorsSafeString(xmlSecKeyDataGetName(src)), |
617 xmlSecErrorsSafeString(xmlSecKeyDataGetName(src)), |
616 "xmlSecSymbianCryptoKeyDataX509GetCrl", |
618 "xmlSecSymbianCryptoKeyDataX509GetCrl", |
617 XMLSEC_ERRORS_R_XMLSEC_FAILED, |
619 XMLSEC_ERRORS_R_XMLSEC_FAILED, |
618 "pos=%d", pos); |
620 "pos=%d", pos); |
619 return(-1); |
621 return(-1); |
620 } |
622 } |
621 |
|
622 if(!crlDst) { |
623 if(!crlDst) { |
623 xmlSecError(XMLSEC_ERRORS_HERE, |
624 xmlSecError(XMLSEC_ERRORS_HERE, |
624 xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)), |
625 xmlSecErrorsSafeString(xmlSecKeyDataGetName(dst)), |
625 "X509_CRL_dup", |
626 "X509_CRL_dup", |
626 XMLSEC_ERRORS_R_CRYPTO_FAILED, |
627 XMLSEC_ERRORS_R_CRYPTO_FAILED, |
1104 xmlNodePtr node, |
1105 xmlNodePtr node, |
1105 xmlSecKeyInfoCtxPtr keyInfoCtx) { |
1106 xmlSecKeyInfoCtxPtr keyInfoCtx) { |
1106 xmlSecKeyDataStorePtr x509Store; |
1107 xmlSecKeyDataStorePtr x509Store; |
1107 xmlChar* subject; |
1108 xmlChar* subject; |
1108 X509* cert; |
1109 X509* cert; |
1109 X509* cert2 = NULL; |
1110 //X509* cert2 = NULL; |
1110 int ret; |
|
1111 |
1111 |
1112 xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataX509Id), -1); |
1112 xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataX509Id), -1); |
1113 xmlSecAssert2(node, -1); |
1113 xmlSecAssert2(node, -1); |
1114 xmlSecAssert2(keyInfoCtx, -1); |
1114 xmlSecAssert2(keyInfoCtx, -1); |
1115 xmlSecAssert2(keyInfoCtx->keysMngr, -1); |
1115 xmlSecAssert2(keyInfoCtx->keysMngr, -1); |
1140 return(0); |
1140 return(0); |
1141 } |
1141 } |
1142 |
1142 |
1143 cert = xmlSecSymbianCryptoX509StoreFindCert(x509Store, subject, NULL, NULL, NULL, keyInfoCtx); |
1143 cert = xmlSecSymbianCryptoX509StoreFindCert(x509Store, subject, NULL, NULL, NULL, keyInfoCtx); |
1144 if(!cert){ |
1144 if(!cert){ |
1145 xmlFree(subject); |
|
1146 |
|
1147 if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CERT) != 0) { |
1145 if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CERT) != 0) { |
1148 xmlSecError(XMLSEC_ERRORS_HERE, |
1146 xmlSecError(XMLSEC_ERRORS_HERE, |
1149 xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), |
1147 xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), |
1150 NULL, |
1148 NULL, |
1151 XMLSEC_ERRORS_R_CERT_NOT_FOUND, |
1149 XMLSEC_ERRORS_R_CERT_NOT_FOUND, |
1152 "subject=%s", |
1150 "subject=%s", |
1153 xmlSecErrorsSafeString(subject)); |
1151 xmlSecErrorsSafeString(subject)); |
|
1152 xmlFree(subject); |
1154 return(-1); |
1153 return(-1); |
1155 } |
1154 } |
|
1155 xmlFree(subject); |
1156 return(0); |
1156 return(0); |
1157 } |
1157 } |
1158 |
1158 |
|
1159 //dead error condition |
|
1160 /* |
1159 if(!cert2) { |
1161 if(!cert2) { |
1160 xmlSecError(XMLSEC_ERRORS_HERE, |
1162 xmlSecError(XMLSEC_ERRORS_HERE, |
1161 xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), |
1163 xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), |
1162 "X509_dup", |
1164 "X509_dup", |
1163 XMLSEC_ERRORS_R_CRYPTO_FAILED, |
1165 XMLSEC_ERRORS_R_CRYPTO_FAILED, |
1223 xmlSecKeyDataStorePtr x509Store; |
1225 xmlSecKeyDataStorePtr x509Store; |
1224 xmlNodePtr cur; |
1226 xmlNodePtr cur; |
1225 xmlChar *issuerName; |
1227 xmlChar *issuerName; |
1226 xmlChar *issuerSerial; |
1228 xmlChar *issuerSerial; |
1227 X509* cert; |
1229 X509* cert; |
1228 X509* cert2 = NULL; |
1230 //X509* cert2 = NULL; |
1229 int ret; |
|
1230 |
1231 |
1231 xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataX509Id), -1); |
1232 xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataX509Id), -1); |
1232 xmlSecAssert2(node, -1); |
1233 xmlSecAssert2(node, -1); |
1233 xmlSecAssert2(keyInfoCtx, -1); |
1234 xmlSecAssert2(keyInfoCtx, -1); |
1234 xmlSecAssert2(keyInfoCtx->keysMngr, -1); |
1235 xmlSecAssert2(keyInfoCtx->keysMngr, -1); |
1318 NULL, |
1319 NULL, |
1319 issuerName, |
1320 issuerName, |
1320 issuerSerial, |
1321 issuerSerial, |
1321 NULL, |
1322 NULL, |
1322 keyInfoCtx); |
1323 keyInfoCtx); |
1323 if(!cert){ |
1324 if(!cert) |
1324 xmlFree(issuerSerial); |
1325 { |
1325 xmlFree(issuerName); |
1326 if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CERT) != 0) |
1326 |
1327 { |
1327 if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CERT) != 0) { |
1328 xmlSecError(XMLSEC_ERRORS_HERE, |
1328 xmlSecError(XMLSEC_ERRORS_HERE, |
|
1329 xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), |
1329 xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), |
1330 NULL, |
1330 NULL, |
1331 XMLSEC_ERRORS_R_CERT_NOT_FOUND, |
1331 XMLSEC_ERRORS_R_CERT_NOT_FOUND, |
1332 "issuerName=%s;issuerSerial=%s", |
1332 "issuerName=%s;issuerSerial=%s", |
1333 xmlSecErrorsSafeString(issuerName), |
1333 xmlSecErrorsSafeString(issuerName), |
1334 xmlSecErrorsSafeString(issuerSerial)); |
1334 xmlSecErrorsSafeString(issuerSerial)); |
1335 return(-1); |
1335 xmlFree(issuerSerial); |
1336 } |
1336 xmlFree(issuerName); |
1337 return(0); |
1337 return(-1); |
1338 } |
1338 } |
1339 |
1339 xmlFree(issuerSerial); |
|
1340 xmlFree(issuerName); |
|
1341 return(0); |
|
1342 } |
|
1343 |
|
1344 /* |
1340 if(!cert2) { |
1345 if(!cert2) { |
1341 xmlSecError(XMLSEC_ERRORS_HERE, |
1346 xmlSecError(XMLSEC_ERRORS_HERE, |
1342 xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), |
1347 xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), |
1343 "X509_dup", |
1348 "X509_dup", |
1344 XMLSEC_ERRORS_R_CRYPTO_FAILED, |
1349 XMLSEC_ERRORS_R_CRYPTO_FAILED, |
1408 XMLSEC_ERRORS_R_XMLSEC_FAILED, |
1413 XMLSEC_ERRORS_R_XMLSEC_FAILED, |
1409 "node=%s", |
1414 "node=%s", |
1410 xmlSecErrorsSafeString(xmlSecNodeX509SerialNumber)); |
1415 xmlSecErrorsSafeString(xmlSecNodeX509SerialNumber)); |
1411 return(-1); |
1416 return(-1); |
1412 } |
1417 } |
1413 |
1418 /* |
1414 /* write data */ |
1419 //write data |
1415 if(!buf) { |
1420 if(!buf) { |
1416 xmlSecError(XMLSEC_ERRORS_HERE, |
1421 xmlSecError(XMLSEC_ERRORS_HERE, |
1417 NULL, |
1422 NULL, |
1418 "xmlSecSymbianCryptoX509NameWrite(X509_get_issuer_name)", |
1423 "xmlSecSymbianCryptoX509NameWrite(X509_get_issuer_name)", |
1419 XMLSEC_ERRORS_R_XMLSEC_FAILED, |
1424 XMLSEC_ERRORS_R_XMLSEC_FAILED, |
1420 XMLSEC_ERRORS_NO_MESSAGE); |
1425 XMLSEC_ERRORS_NO_MESSAGE); |
1421 return(-1); |
1426 return(-1); |
1422 } |
1427 } |
1423 xmlNodeSetContent(issuerNameNode, buf); |
1428 |
1424 xmlFree(buf); |
|
1425 |
|
1426 if(!buf) { |
1429 if(!buf) { |
1427 xmlSecError(XMLSEC_ERRORS_HERE, |
1430 xmlSecError(XMLSEC_ERRORS_HERE, |
1428 NULL, |
1431 NULL, |
1429 "xmlSecSymbianCryptoASN1IntegerWrite(X509_get_serialNumber)", |
1432 "xmlSecSymbianCryptoASN1IntegerWrite(X509_get_serialNumber)", |
1430 XMLSEC_ERRORS_R_XMLSEC_FAILED, |
1433 XMLSEC_ERRORS_R_XMLSEC_FAILED, |
1431 XMLSEC_ERRORS_NO_MESSAGE); |
1434 XMLSEC_ERRORS_NO_MESSAGE); |
1432 return(-1); |
1435 return(-1); |
1433 } |
1436 } |
|
1437 */ |
|
1438 xmlNodeSetContent(issuerNameNode, buf); |
1434 xmlNodeSetContent(issuerNumberNode, buf); |
1439 xmlNodeSetContent(issuerNumberNode, buf); |
1435 xmlFree(buf); |
1440 xmlFree(buf); |
1436 |
1441 |
1437 return(0); |
1442 return(0); |
1438 } |
1443 } |
1443 xmlNodePtr node, |
1448 xmlNodePtr node, |
1444 xmlSecKeyInfoCtxPtr keyInfoCtx) { |
1449 xmlSecKeyInfoCtxPtr keyInfoCtx) { |
1445 xmlSecKeyDataStorePtr x509Store; |
1450 xmlSecKeyDataStorePtr x509Store; |
1446 xmlChar* ski; |
1451 xmlChar* ski; |
1447 X509* cert; |
1452 X509* cert; |
1448 X509* cert2 = NULL; |
|
1449 int ret; |
|
1450 |
1453 |
1451 xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataX509Id), -1); |
1454 xmlSecAssert2(xmlSecKeyDataCheckId(data, xmlSecSymbianCryptoKeyDataX509Id), -1); |
1452 xmlSecAssert2(node, -1); |
1455 xmlSecAssert2(node, -1); |
1453 xmlSecAssert2(keyInfoCtx, -1); |
1456 xmlSecAssert2(keyInfoCtx, -1); |
1454 xmlSecAssert2(keyInfoCtx->keysMngr, -1); |
1457 xmlSecAssert2(keyInfoCtx->keysMngr, -1); |
1480 return(0); |
1483 return(0); |
1481 } |
1484 } |
1482 |
1485 |
1483 cert = xmlSecSymbianCryptoX509StoreFindCert(x509Store, NULL, NULL, NULL, ski, keyInfoCtx); |
1486 cert = xmlSecSymbianCryptoX509StoreFindCert(x509Store, NULL, NULL, NULL, ski, keyInfoCtx); |
1484 if(!cert){ |
1487 if(!cert){ |
1485 xmlFree(ski); |
|
1486 |
|
1487 if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CERT) != 0) { |
1488 if((keyInfoCtx->flags & XMLSEC_KEYINFO_FLAGS_X509DATA_STOP_ON_UNKNOWN_CERT) != 0) { |
1488 xmlSecError(XMLSEC_ERRORS_HERE, |
1489 xmlSecError(XMLSEC_ERRORS_HERE, |
1489 xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), |
1490 xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), |
1490 NULL, |
1491 NULL, |
1491 XMLSEC_ERRORS_R_CERT_NOT_FOUND, |
1492 XMLSEC_ERRORS_R_CERT_NOT_FOUND, |
1492 "ski=%s", |
1493 "ski=%s", |
1493 xmlSecErrorsSafeString(ski)); |
1494 xmlSecErrorsSafeString(ski)); |
|
1495 xmlFree(ski); |
1494 return(-1); |
1496 return(-1); |
1495 } |
1497 } |
|
1498 xmlFree(ski); |
1496 return(0); |
1499 return(0); |
1497 } |
1500 } |
1498 |
1501 |
|
1502 //dead error condition |
|
1503 /* |
1499 if(!cert2) { |
1504 if(!cert2) { |
1500 xmlSecError(XMLSEC_ERRORS_HERE, |
1505 xmlSecError(XMLSEC_ERRORS_HERE, |
1501 xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), |
1506 xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), |
1502 "X509_dup", |
1507 "X509_dup", |
1503 XMLSEC_ERRORS_R_CRYPTO_FAILED, |
1508 XMLSEC_ERRORS_R_CRYPTO_FAILED, |
1504 XMLSEC_ERRORS_NO_MESSAGE); |
1509 XMLSEC_ERRORS_NO_MESSAGE); |
1505 xmlFree(ski); |
1510 xmlFree(ski); |
1506 return(-1); |
1511 return(-1); |
1507 } |
1512 } |
1508 |
1513 |
1509 ret = xmlSecSymbianCryptoKeyDataX509AdoptCert(data, cert2); |
1514 ret = xmlSecSymbianCryptoKeyDataX509AdoptCert(data, cert2); |
1510 if(ret < 0) { |
1515 if(ret < 0) { |
1511 xmlSecError(XMLSEC_ERRORS_HERE, |
1516 xmlSecError(XMLSEC_ERRORS_HERE, |
1512 xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), |
1517 xmlSecErrorsSafeString(xmlSecKeyDataGetName(data)), |
1513 "xmlSecSymbianCryptoKeyDataX509AdoptCert", |
1518 "xmlSecSymbianCryptoKeyDataX509AdoptCert", |
1514 XMLSEC_ERRORS_R_XMLSEC_FAILED, |
1519 XMLSEC_ERRORS_R_XMLSEC_FAILED, |
1515 XMLSEC_ERRORS_NO_MESSAGE); |
1520 XMLSEC_ERRORS_NO_MESSAGE); |
1516 xmlFree(ski); |
1521 xmlFree(ski); |
1517 return(-1); |
1522 return(-1); |
1518 } |
1523 } |
|
1524 */ |
1519 |
1525 |
1520 xmlFree(ski); |
1526 xmlFree(ski); |
1521 return(0); |
1527 return(0); |
1522 } |
1528 } |
1523 |
1529 |
2438 xmlSecError(XMLSEC_ERRORS_HERE, |
2444 xmlSecError(XMLSEC_ERRORS_HERE, |
2439 xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), |
2445 xmlSecErrorsSafeString(xmlSecKeyDataKlassGetName(id)), |
2440 "xmlSecSymbianCryptoKeyDataX509VerifyAndExtractKey", |
2446 "xmlSecSymbianCryptoKeyDataX509VerifyAndExtractKey", |
2441 XMLSEC_ERRORS_R_XMLSEC_FAILED, |
2447 XMLSEC_ERRORS_R_XMLSEC_FAILED, |
2442 XMLSEC_ERRORS_NO_MESSAGE); |
2448 XMLSEC_ERRORS_NO_MESSAGE); |
2443 return(-1); |
2449 X509_free(cert); |
2444 } |
2450 return(-1); |
|
2451 } |
|
2452 X509_free(cert); |
2445 return(0); |
2453 return(0); |
2446 } |
2454 } |
2447 |
2455 |
2448 |
2456 |
2449 #endif /* XMLSEC_NO_X509 */ |
2457 #endif /* XMLSEC_NO_X509 */ |