diff --git a/vanetza/security/CMakeLists.txt b/vanetza/security/CMakeLists.txt index eebd8891d..66b1fb1d4 100644 --- a/vanetza/security/CMakeLists.txt +++ b/vanetza/security/CMakeLists.txt @@ -47,7 +47,6 @@ add_vanetza_component(security v2/validity_restriction.cpp v2/verification.cpp v3/asn1_conversions.cpp - v3/basic_elements.cpp v3/certificate.cpp v3/certificate_cache.cpp v3/certificate_validator.cpp @@ -60,7 +59,6 @@ add_vanetza_component(security v3/static_certificate_provider.cpp v3/persistence.cpp v3/trust_store.cpp - v3/validity_restriction.cpp ) target_link_libraries(security PUBLIC asn1 asn1_security common net) target_link_libraries(security PRIVATE GeographicLib::GeographicLib) diff --git a/vanetza/security/v3/basic_elements.cpp b/vanetza/security/v3/basic_elements.cpp deleted file mode 100644 index b3714c70f..000000000 --- a/vanetza/security/v3/basic_elements.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#include -#include -#include -#include -#include -#include - -namespace vanetza -{ -namespace security -{ -namespace v3 -{ - -Time32 convert_time32(const Clock::time_point& tp) -{ - using std::chrono::duration_cast; - using seconds = std::chrono::duration; - return duration_cast(tp.time_since_epoch()).count(); -} - -Clock::time_point convert_time_point(const Time32& t) -{ - using std::chrono::duration_cast; - using seconds = std::chrono::duration; - return Clock::time_point { duration_cast(seconds(t)) }; -} - -Clock::time_point convert_time_point(const Time64& t) -{ - using std::chrono::duration_cast; - using microseconds = std::chrono::duration; - return Clock::time_point { duration_cast(microseconds(t)) }; -} - -Time64 convert_time64(const Clock::time_point& tp) -{ - using std::chrono::duration_cast; - using microseconds = std::chrono::duration; - return duration_cast(tp.time_since_epoch()).count(); -} - - -} // namespace v3 -} // namespace security -} // namespace vanetza diff --git a/vanetza/security/v3/basic_elements.hpp b/vanetza/security/v3/basic_elements.hpp deleted file mode 100644 index 41c223802..000000000 --- a/vanetza/security/v3/basic_elements.hpp +++ /dev/null @@ -1,48 +0,0 @@ -#pragma once -#include -#include -#include -#include -#include - -namespace vanetza -{ -namespace security -{ -namespace v3 -{ - -using Time64 = uint64_t; -using Time32 = uint32_t; - -/** - * Convert time point to time stamp - * \param tp time point - * \return time stamp with second accuracy - */ -Time32 convert_time32(const Clock::time_point& tp); - -/** - * Convert time stamp to time point - * \param t time stamp with second accuracy - * \return time point - */ -Clock::time_point convert_time_point(const Time32& t); - -/** - * Convert time point to time stamp - * \param tp time point - * \return time stamp with microsecond accuracy - */ -Time64 convert_time64(const Clock::time_point& tp); - -/** - * Convert time stamp to time point - * \param t time stamp with microsecond accuracy - * \return time point - */ -Clock::time_point convert_time_point(const Time64& t); - -} // namespace v3 -} // namespace security -} // namespace vanetza diff --git a/vanetza/security/v3/certificate.cpp b/vanetza/security/v3/certificate.cpp index 11bf44309..0fbe55630 100644 --- a/vanetza/security/v3/certificate.cpp +++ b/vanetza/security/v3/certificate.cpp @@ -105,10 +105,10 @@ bool valid_at_location(const asn1::EtsiTs103097Certificate& cert, const Position return is_inside(location, region->choice.rectangularRegion); case Vanetza_Security_GeographicRegion_PR_polygonalRegion: // not supported yet - return false; + return true; case Vanetza_Security_GeographicRegion_PR_identifiedRegion: // not supported yet - return false; + return true; default: // unknown region restriction return false; @@ -226,43 +226,6 @@ bool CertificateView::is_canonical() const return m_cert ? v3::is_canonical(*m_cert) : false; } -StartAndEndValidity CertificateView::get_start_and_end_validity() const -{ - StartAndEndValidity start_and_end; - start_and_end.start_validity = Time32(m_cert->toBeSigned.validityPeriod.start); - Time32 duration = 0; - switch (m_cert->toBeSigned.validityPeriod.duration.present) - { - case Vanetza_Security_Duration_PR_NOTHING: - break; - case Vanetza_Security_Duration_PR_microseconds: - duration += (int)m_cert->toBeSigned.validityPeriod.duration.choice.microseconds/1000000; - break; - case Vanetza_Security_Duration_PR_milliseconds: - duration += (int)m_cert->toBeSigned.validityPeriod.duration.choice.milliseconds/1000; - break; - case Vanetza_Security_Duration_PR_seconds: - duration += (int)m_cert->toBeSigned.validityPeriod.duration.choice.seconds; - break; - case Vanetza_Security_Duration_PR_minutes: - duration += (int)m_cert->toBeSigned.validityPeriod.duration.choice.minutes*60; - break; - case Vanetza_Security_Duration_PR_hours: - duration += (int)m_cert->toBeSigned.validityPeriod.duration.choice.hours*60*60; - break; - case Vanetza_Security_Duration_PR_sixtyHours: - duration += (int)m_cert->toBeSigned.validityPeriod.duration.choice.sixtyHours*60*60*60; - break; - case Vanetza_Security_Duration_PR_years: - duration += (int)m_cert->toBeSigned.validityPeriod.duration.choice.years*60*60*24*365; - break; - default: - break; - } - start_and_end.end_validity = start_and_end.start_validity + duration; - return start_and_end; -} - bool is_canonical(const asn1::EtsiTs103097Certificate& cert) { bool compressed_point = true; diff --git a/vanetza/security/v3/certificate.hpp b/vanetza/security/v3/certificate.hpp index c8bd48af0..a5cbab3f7 100644 --- a/vanetza/security/v3/certificate.hpp +++ b/vanetza/security/v3/certificate.hpp @@ -10,7 +10,6 @@ #include #include #include -#include #include #include @@ -41,8 +40,6 @@ class CertificateView */ boost::optional calculate_digest() const; - StartAndEndValidity get_start_and_end_validity() const; - KeyType get_verification_key_type() const; /** diff --git a/vanetza/security/v3/validity_restriction.cpp b/vanetza/security/v3/validity_restriction.cpp deleted file mode 100644 index fbf9e6c3b..000000000 --- a/vanetza/security/v3/validity_restriction.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include - - -namespace vanetza -{ -namespace security -{ -namespace v3 -{ - -StartAndEndValidity::StartAndEndValidity(Time32 start, Time32 end) : - start_validity(start), end_validity(end) -{ -} - -} // namespace v3 -} // namespace security -} // namespace vanetza \ No newline at end of file diff --git a/vanetza/security/v3/validity_restriction.hpp b/vanetza/security/v3/validity_restriction.hpp deleted file mode 100644 index e8d7f511d..000000000 --- a/vanetza/security/v3/validity_restriction.hpp +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once -#include - -namespace vanetza -{ -namespace security -{ -namespace v3 -{ - -using Time32 = std::uint32_t; - -struct StartAndEndValidity -{ - StartAndEndValidity() = default; - StartAndEndValidity(Time32 start, Time32 end); - - Time32 start_validity; - Time32 end_validity; -}; - -} // namespace v3 -} // namespace security -} // namespace vanetza