Files
bouncycastle-fips/bouncycastle-fips.spec

138 lines
4.1 KiB
RPMSpec

#
# spec file for package bouncycastle-fips
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%global classname org.bouncycastle.jcajce.provider.BouncyCastleFipsProvider
# The automatic requires would be java-headless >= 9, but the
# binaries are java 8 compatible
%define __requires_exclude java-headless
Name: bouncycastle-fips
Version: 1.0.2.4
Release: 0
Summary: Bouncy Castle Provider (FIPS Distribution)
License: MIT
Group: Development/Libraries/Java
URL: https://www.bouncycastle.org
Source0: https://repo1.maven.org/maven2/org/bouncycastle/bc-fips/%{version}/bc-fips-%{version}-sources.jar
Source1: https://repo1.maven.org/maven2/org/bouncycastle/bc-fips/%{version}/bc-fips-%{version}.pom
Source2: %{name}-build.xml
BuildRequires: ant
BuildRequires: fdupes
BuildRequires: java-devel >= 9
BuildRequires: javapackages-local >= 6
BuildRequires: unzip
Requires: java-headless >= 1.8
Requires(post): javapackages-tools
Requires(postun): javapackages-tools
BuildArch: noarch
%description
The FIPS 140-2 Bouncy Castle Crypto package is a Java implementation
of cryptographic algorithms certified to FIPS 140-2 level 1.
This jar contains JCE provider and low-level API for the BC-FJA
version %{version}, FIPS Certificate #3514.
Please see certificate for certified platform details.
%package javadoc
Summary: Javadoc for %{name}
Group: Documentation/HTML
%description javadoc
API documentation for %{name}.
%prep
%setup -q -c -n bc-fips-%{version}
cp %{SOURCE2} build.xml
mv META-INF/versions/9/* .
rm -rf META-INF/versions
%{ant} jar javadoc
%install
install -dm 755 %{buildroot}%{_sysconfdir}/java/security/security.d
touch %{buildroot}%{_sysconfdir}/java/security/security.d/2000-%{classname}
# jar
install -dm 0755 %{buildroot}%{_javadir}
install -pm 0644 target/bc-fips.jar %{buildroot}%{_javadir}/bcfips.jar
# pom
install -dm 0755 %{buildroot}%{_mavenpomdir}
%{mvn_install_pom} %{SOURCE1} %{buildroot}%{_mavenpomdir}/bcfips.pom
%add_maven_depmap bcfips.pom bcfips.jar
# javadoc
install -dm 0755 %{buildroot}%{_javadocdir}/%{name}
cp -r target/site/apidocs/* %{buildroot}%{_javadocdir}/%{name}/
%fdupes -s %{buildroot}%{_javadocdir}
%post
{
# Rebuild the list of security providers in classpath.security
suffix=security/classpath.security
secfiles="%{_prefix}/lib/$suffix %{_libdir}/$suffix"
for secfile in $secfiles
do
# check if this classpath.security file exists
[ -f "$secfile" ] || continue
sed -i '/^security\.provider\./d' "$secfile"
count=0
for provider in $(ls %{_sysconfdir}/java/security/security.d)
do
count=$((count + 1))
echo "security.provider.${count}=${provider#*-}" >> "$secfile"
done
done
} || :
%postun
if [ $1 -eq 0 ] ; then
{
# Rebuild the list of security providers in classpath.security
suffix=security/classpath.security
secfiles="%{_prefix}/lib/$suffix %{_libdir}/$suffix"
for secfile in $secfiles
do
# check if this classpath.security file exists
[ -f "$secfile" ] || continue
sed -i '/^security\.provider\./d' "$secfile"
count=0
for provider in $(ls %{_sysconfdir}/java/security/security.d)
do
count=$((count + 1))
echo "security.provider.${count}=${provider#*-}" >> "$secfile"
done
done
} || :
fi
%files -f .mfiles
%license target/classes/META-INF/LICENSE.txt
%config(noreplace) %{_sysconfdir}/java/security/security.d/2000-%{classname}
%files javadoc
%{_javadocdir}/%{name}
%license target/classes/META-INF/LICENSE.txt
%changelog