compatibility

package
v1.25.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 19, 2026 License: MIT Imports: 14 Imported by: 0

README ¶

OpenSSL Compatibility Framework

This directory contains comprehensive compatibility tests ensuring perfect interoperability between GoPKI and OpenSSL for all cryptographic operations.

Overview

The OpenSSL compatibility framework validates that cryptographic operations, certificates, signatures, and key operations generated by GoPKI are fully compatible with OpenSSL and vice versa. This ensures that GoPKI can be used as a drop-in replacement for OpenSSL operations in Go applications.

Structure

compatibility/
├── keypair/            # Keypair compatibility tests
│   ├── keypair_test.go # RSA, ECDSA, Ed25519 key compatibility tests
│   ├── ssh_test.go     # SSH/OpenSSH compatibility tests
│   ├── doc.md         # Detailed keypair compatibility documentation
│   └── ssh_doc.md     # SSH compatibility documentation
├── cert/               # Certificate compatibility tests
│   ├── cert_test.go    # X.509 certificate compatibility tests
│   ├── doc.md         # Certificate compatibility documentation
│   └── testdata/       # Test certificates and reference data
├── signing/            # Digital signature compatibility tests
│   ├── signing_test.go # PKCS#7/CMS signature compatibility tests
│   ├── doc.md         # Comprehensive signing compatibility documentation
│   └── README.md      # Quick signing compatibility reference
├── helpers.go          # OpenSSL integration utilities
└── README.md          # This overview

Quick Start

Run All Compatibility Tests
# Using Taskfile (recommended)
task test:compatibility

# Direct Go command
go test -tags=compatibility ./compatibility/... -v
Run Specific Module Tests
# Keypair-specific tests only
go test -tags=compatibility ./compatibility/keypair -v

# Certificate-specific tests only
go test -tags=compatibility ./compatibility/cert -v

# Signing-specific tests only
go test -tags=compatibility ./compatibility/signing -v

Test Coverage

✅ Keypair Compatibility (./keypair/)
  • RSA: 2048, 3072, 4096-bit keys
  • ECDSA: P-256, P-384, P-521 curves
  • Ed25519: Modern high-performance curve
  • Bidirectional testing: GoPKI ↔ OpenSSL
  • Format validation: PEM, DER, SSH
  • Signature interoperability: Cross-platform verification
✅ Certificate Compatibility (./cert/)
  • Self-Signed Certificates: All algorithms with OpenSSL validation
  • CA Certificates: Path length constraints and CA extensions
  • Certificate Signing: CA-signed certificates with chain validation
  • Subject Alternative Names: DNS, IP, email address extensions
  • Format Interoperability: PEM ↔ DER conversion
  • Certificate Chain Validation: Multi-level certificate hierarchies
  • Edge Cases: Invalid certificates, expired certificates
✅ Signing Compatibility (./signing/)
  • Raw Signatures: RSA, ECDSA, Ed25519 signature generation and verification
  • PKCS#7/CMS Formats: Attached and detached signature containers
  • Certificate Chain Integration: Multi-level certificate inclusion
  • Bidirectional Testing: GoPKI ↔ OpenSSL signature validation
  • Hash Algorithms: SHA256, SHA384, SHA512 support
  • Format Standards: RFC 5652 CMS compliance validation
  • Advanced Features: Signature metadata extraction and validation
🔮 Future Compatibility Tests

As GoPKI grows, additional compatibility tests will be organized here:

  • ./encryption/ - Encryption/decryption compatibility
  • ./pkcs12/ - PKCS#12 container compatibility

Features

  • Enhanced Logging: Every OpenSSL command execution is logged with results
  • Testify Assertions: Clean, readable test assertions
  • Automatic Cleanup: Temporary files are properly managed
  • Cross-Platform: Works with OpenSSL 3.x, 1.1.1, LibreSSL
  • Security Validation: Ensures cryptographic correctness
  • Build Tags: Uses //go:build compatibility for conditional testing

Build Tags

The compatibility tests use build tags to allow conditional execution:

# Include compatibility tests
go test -tags=compatibility ./compatibility/... -v

# Regular tests (excludes compatibility tests)
go test ./compatibility/... -v  # Will find no test files

This allows for:

  • Conditional Testing: Compatibility tests only run when explicitly tagged
  • CI/CD Flexibility: Can skip expensive OpenSSL tests in certain environments
  • Development Workflow: Developers can run regular tests without OpenSSL dependency

Sample Output

🔗 Running OpenSSL Compatibility Tests...
   This tests interoperability between GoPKI and OpenSSL

=== RUN   TestSelfSignedCertificateCompatibility/RSA_2048/GoPKI_Generate_OpenSSL_Validate
    → Validating certificate with OpenSSL...
    → Executing: openssl x509 -in /tmp/validate_cert.pem -text -noout
    ✓ Success: Certificate validation passed
    ✓ GoPKI RSA-2048 self-signed certificate validated by OpenSSL

--- PASS: TestSelfSignedCertificateCompatibility/RSA_2048 (0.31s)
✅ OpenSSL compatibility tests completed

Requirements

Software Dependencies
  • OpenSSL 3.0+ (compatible with older versions)
  • Go 1.21+ with module support
  • testify assertion library
OpenSSL Version Compatibility

The tests are designed to work with:

  • OpenSSL 3.x (primary target)
  • OpenSSL 1.1.1 (legacy support)
  • LibreSSL (partial compatibility)

Version-specific behavior is handled automatically by the framework.

Installation & Setup

Install OpenSSL
# macOS
brew install openssl

# Ubuntu/Debian
sudo apt-get install openssl

# RHEL/CentOS
sudo yum install openssl
Verify Installation
# Check OpenSSL version
openssl version

# Test basic functionality
task test:compatibility

Documentation

  • Keypair Compatibility: See ./keypair/doc.md for comprehensive keypair compatibility documentation
  • SSH Compatibility: See ./keypair/ssh_doc.md for SSH/OpenSSH compatibility documentation
  • Certificate Compatibility: See ./cert/doc.md for certificate compatibility documentation
  • Signing Compatibility: See ./signing/doc.md for comprehensive digital signature compatibility documentation
  • Implementation Details: Architecture, usage examples, and troubleshooting
  • Standards Compliance: RFC references and OpenSSL command documentation

Integration Examples

CI/CD Integration
# GitHub Actions example
- name: Run OpenSSL Compatibility Tests
  run: |
    task test:compatibility

# Jenkins example
pipeline {
    stages {
        stage('Compatibility Tests') {
            steps {
                sh 'go test -tags=compatibility ./compatibility/... -v'
            }
        }
    }
}
Docker Integration
FROM golang:1.21-alpine
RUN apk add --no-cache openssl
COPY . /app
WORKDIR /app
RUN go test -tags=compatibility ./compatibility/... -v

Troubleshooting

Common Issues

OpenSSL Not Found

# Check if OpenSSL is in PATH
which openssl

# Check version
openssl version

Permission Errors

# Ensure temporary directory is writable
chmod 755 /tmp

# Check Go module permissions
go clean -modcache

Test Failures

  • Check OpenSSL version compatibility
  • Verify temporary directory permissions
  • Enable verbose logging with -v flag
  • Check specific test documentation in module subdirectories
Performance Considerations
  • RSA-4096 certificate generation can take 1-2 seconds
  • ECDSA tests are typically fastest
  • Ed25519 offers best performance/security ratio
  • Certificate chain validation is CPU-intensive
  • Parallel test execution is automatically handled

Contributing

Adding New Compatibility Tests
  1. Create new module directory under compatibility/
  2. Add algorithm-specific helper functions in helpers.go
  3. Create test cases following the existing pattern
  4. Update Taskfile with new test targets
  5. Add documentation for the new module
Test Enhancement Guidelines
  • Always use bidirectional testing (GoPKI ↔ OpenSSL)
  • Include format conversion verification
  • Add comprehensive logging for debugging
  • Use descriptive test names and logging
  • Follow existing naming conventions
  • Ensure test independence (no shared state)
  • Clean up temporary resources
  • Use build tags for conditional testing
Code Quality Standards
  • Use testify assertions for clean error handling
  • Add comprehensive logging for debugging
  • Follow existing naming conventions
  • Ensure test independence (no shared state)
  • Clean up temporary resources

Security Considerations

Validation Scope

The compatibility tests verify:

  • Cryptographic Correctness: Operations generate valid cryptographic results
  • Format Standards Compliance: Output matches RFC specifications
  • Cross-Platform Interoperability: Works across different systems
  • Algorithm Parameter Validation: Correct curve parameters, key sizes
  • Certificate Standards: X.509 compliance and extension handling
Security Boundaries

The tests do NOT validate:

  • Side-channel attack resistance
  • Timing attack protection
  • Hardware security module integration
  • Key entropy quality (beyond basic validation)
Key Material Handling
  • All test keys and certificates are generated in temporary directories
  • Private keys are automatically cleaned up after tests
  • No real cryptographic material is exposed
  • Test keys should never be used in production

This framework ensures GoPKI maintains 100% compatibility with OpenSSL operations across all supported algorithms and certificate types.

Documentation ¶

Overview ¶

Package compatibility provides test helpers for verifying cryptographic interoperability with external tools like OpenSSL.

Index ¶

Constants ¶

This section is empty.

Variables ¶

This section is empty.

Functions ¶

func CompareECDSAKeys ¶

func CompareECDSAKeys(key1, key2 *ecdsa.PrivateKey) bool

CompareECDSAKeys compares ECDSA keys for mathematical equivalence

func CompareEd25519Keys ¶

func CompareEd25519Keys(key1, key2 ed25519.PrivateKey) bool

CompareEd25519Keys compares Ed25519 keys for equivalence

func CompareRSAKeys ¶

func CompareRSAKeys(key1, key2 *rsa.PrivateKey) bool

CompareRSAKeys compares RSA keys for mathematical equivalence

func CreateTestData ¶

func CreateTestData() []byte

CreateTestData creates test data for signing/verification

func ParsePrivateKeyPEM ¶

func ParsePrivateKeyPEM(pemData []byte) (interface{}, error)

ParsePrivateKeyPEM parses a PEM-encoded private key

func ParsePublicKeyPEM ¶

func ParsePublicKeyPEM(pemData []byte) (interface{}, error)

ParsePublicKeyPEM parses a PEM-encoded public key

Types ¶

type OpenSSLHelper ¶

type OpenSSLHelper struct {
	// contains filtered or unexported fields
}

OpenSSLHelper provides utilities for OpenSSL command execution

func NewOpenSSLHelper ¶

func NewOpenSSLHelper(t *testing.T) *OpenSSLHelper

NewOpenSSLHelper creates a new OpenSSL helper instance

func (*OpenSSLHelper) Cleanup ¶

func (h *OpenSSLHelper) Cleanup()

Cleanup removes temporary files

func (*OpenSSLHelper) ConvertCertDERToPEMWithOpenSSL ¶

func (h *OpenSSLHelper) ConvertCertDERToPEMWithOpenSSL(certDER []byte) ([]byte, error)

ConvertCertDERToPEMWithOpenSSL converts certificate from DER to PEM using OpenSSL

func (*OpenSSLHelper) ConvertCertPEMToDERWithOpenSSL ¶

func (h *OpenSSLHelper) ConvertCertPEMToDERWithOpenSSL(certPEM []byte) ([]byte, error)

ConvertCertPEMToDERWithOpenSSL converts certificate from PEM to DER using OpenSSL

func (*OpenSSLHelper) ConvertPEMToSSHWithSSHKeygen ¶

func (h *OpenSSLHelper) ConvertPEMToSSHWithSSHKeygen(pemPrivateKey []byte) ([]byte, error)

ConvertPEMToSSHWithSSHKeygen converts a PEM private key to SSH format using ssh-keygen

func (*OpenSSLHelper) ConvertSSHToPEMWithSSHKeygen ¶ added in v1.15.0

func (h *OpenSSLHelper) ConvertSSHToPEMWithSSHKeygen(sshPrivateKey []byte) ([]byte, error)

ConvertSSHToPEMWithSSHKeygen converts SSH private key to PEM format using ssh-keygen

func (*OpenSSLHelper) CreatePKCS7SignatureWithOpenSSL ¶ added in v1.14.0

func (h *OpenSSLHelper) CreatePKCS7SignatureWithOpenSSL(data, privateKeyPEM, certPEM []byte, detached bool) ([]byte, error)

CreatePKCS7SignatureWithOpenSSL creates a PKCS#7 signature using OpenSSL

func (*OpenSSLHelper) CreateRawSignatureWithOpenSSL ¶ added in v1.14.0

func (h *OpenSSLHelper) CreateRawSignatureWithOpenSSL(data, privateKeyPEM []byte, algorithm, hashAlg string) ([]byte, error)

CreateRawSignatureWithOpenSSL creates a raw signature using OpenSSL

func (*OpenSSLHelper) CreateTestCertificate ¶ added in v1.16.0

func (h *OpenSSLHelper) CreateTestCertificate(publicKey interface{}, privateKey interface{}, subject string) (*x509.Certificate, error)

CreateTestCertificate creates a test certificate for encryption testing

func (*OpenSSLHelper) DecryptAESGCMWithOpenSSL ¶ added in v1.16.0

func (h *OpenSSLHelper) DecryptAESGCMWithOpenSSL(encryptedData []byte, key []byte, iv []byte, tag []byte, keySize int) ([]byte, error)

DecryptAESGCMWithOpenSSL decrypts data using AES-GCM with OpenSSL

func (*OpenSSLHelper) DecryptRSAOAEPWithOpenSSL ¶ added in v1.16.0

func (h *OpenSSLHelper) DecryptRSAOAEPWithOpenSSL(encryptedData []byte, privateKeyPEM []byte) ([]byte, error)

DecryptRSAOAEPWithOpenSSL decrypts data using RSA-OAEP with OpenSSL

func (*OpenSSLHelper) EncryptAESGCMWithOpenSSL ¶ added in v1.16.0

func (h *OpenSSLHelper) EncryptAESGCMWithOpenSSL(data []byte, key []byte, keySize int) ([]byte, []byte, []byte, error)

EncryptAESGCMWithOpenSSL encrypts data using AES-GCM with OpenSSL

func (*OpenSSLHelper) EncryptRSAOAEPWithOpenSSL ¶ added in v1.16.0

func (h *OpenSSLHelper) EncryptRSAOAEPWithOpenSSL(data []byte, publicKeyPEM []byte) ([]byte, error)

EncryptRSAOAEPWithOpenSSL encrypts data using RSA-OAEP with OpenSSL

func (*OpenSSLHelper) ExtractPublicKeyWithSSHKeygen ¶

func (h *OpenSSLHelper) ExtractPublicKeyWithSSHKeygen(privateKeyData []byte) ([]byte, error)

ExtractPublicKeyWithSSHKeygen extracts public key from private key using ssh-keygen

func (*OpenSSLHelper) ExtractSignatureInfoWithOpenSSL ¶ added in v1.14.0

func (h *OpenSSLHelper) ExtractSignatureInfoWithOpenSSL(signatureData []byte) (string, error)

ExtractSignatureInfoWithOpenSSL extracts signature information using OpenSSL

func (*OpenSSLHelper) GenerateCACertWithOpenSSL ¶

func (h *OpenSSLHelper) GenerateCACertWithOpenSSL(privateKeyPEM []byte, subject string) ([]byte, error)

GenerateCACertWithOpenSSL generates a CA certificate using OpenSSL

func (*OpenSSLHelper) GenerateCSRWithOpenSSL ¶

func (h *OpenSSLHelper) GenerateCSRWithOpenSSL(privateKeyPEM []byte, subject, san string) ([]byte, error)

GenerateCSRWithOpenSSL generates a certificate signing request using OpenSSL

func (*OpenSSLHelper) GenerateECDSAWithOpenSSL ¶

func (h *OpenSSLHelper) GenerateECDSAWithOpenSSL(curveName string) (privateKeyPEM, publicKeyPEM []byte, err error)

GenerateECDSAWithOpenSSL generates an ECDSA key pair using OpenSSL

func (*OpenSSLHelper) GenerateEd25519WithOpenSSL ¶

func (h *OpenSSLHelper) GenerateEd25519WithOpenSSL() (privateKeyPEM, publicKeyPEM []byte, err error)

GenerateEd25519WithOpenSSL generates an Ed25519 key pair using OpenSSL

func (*OpenSSLHelper) GenerateRSAWithOpenSSL ¶

func (h *OpenSSLHelper) GenerateRSAWithOpenSSL(keySize int) (privateKeyPEM, publicKeyPEM []byte, err error)

GenerateRSAWithOpenSSL generates an RSA key pair using OpenSSL

func (*OpenSSLHelper) GenerateSSHKeyWithPassphrase ¶

func (h *OpenSSLHelper) GenerateSSHKeyWithPassphrase(algorithm string, keySize int, passphrase string) (privateKeyData, publicKeyData []byte, err error)

GenerateSSHKeyWithPassphrase generates a passphrase-protected SSH key using ssh-keygen

func (*OpenSSLHelper) GenerateSSHKeyWithSSHKeygen ¶

func (h *OpenSSLHelper) GenerateSSHKeyWithSSHKeygen(algorithm string, keySize int) (privateKeyData, publicKeyData []byte, err error)

GenerateSSHKeyWithSSHKeygen generates an SSH key pair using ssh-keygen

func (*OpenSSLHelper) GenerateSelfSignedCertWithOpenSSL ¶

func (h *OpenSSLHelper) GenerateSelfSignedCertWithOpenSSL(privateKeyPEM []byte, subject, san string) ([]byte, error)

GenerateSelfSignedCertWithOpenSSL generates a self-signed certificate using OpenSSL

func (*OpenSSLHelper) GenerateX25519KeyPairWithOpenSSL ¶ added in v1.16.0

func (h *OpenSSLHelper) GenerateX25519KeyPairWithOpenSSL() ([]byte, []byte, error)

GenerateX25519KeyPairWithOpenSSL generates X25519 key pair using OpenSSL

func (*OpenSSLHelper) GetSSHKeyFingerprint ¶

func (h *OpenSSLHelper) GetSSHKeyFingerprint(publicKeyData []byte, hashAlg string) (string, error)

GetSSHKeyFingerprint gets the fingerprint of an SSH public key using ssh-keygen

func (*OpenSSLHelper) GetSSHKeyInformation ¶ added in v1.15.0

func (h *OpenSSLHelper) GetSSHKeyInformation(publicKeyData []byte) (string, error)

GetSSHKeyInformation gets detailed information about an SSH key using ssh-keygen

func (*OpenSSLHelper) PerformECDHWithOpenSSL ¶ added in v1.16.0

func (h *OpenSSLHelper) PerformECDHWithOpenSSL(privateKeyPEM []byte, peerPublicKeyPEM []byte) ([]byte, error)

PerformECDHWithOpenSSL performs ECDH key agreement using OpenSSL

func (*OpenSSLHelper) PerformX25519WithOpenSSL ¶ added in v1.16.0

func (h *OpenSSLHelper) PerformX25519WithOpenSSL(privateKeyPEM []byte, peerPublicKeyPEM []byte) ([]byte, error)

PerformX25519WithOpenSSL performs X25519 key agreement using OpenSSL

func (*OpenSSLHelper) ReadFile ¶ added in v1.16.0

func (h *OpenSSLHelper) ReadFile(filepath string) ([]byte, error)

ReadFile reads content from a file

func (*OpenSSLHelper) RunOpenSSL ¶

func (h *OpenSSLHelper) RunOpenSSL(args ...string) ([]byte, error)

RunOpenSSL executes an OpenSSL command and returns the output

func (*OpenSSLHelper) RunOpenSSLCommand ¶ added in v1.16.0

func (h *OpenSSLHelper) RunOpenSSLCommand(cmd string) ([]byte, error)

RunOpenSSLCommand runs a raw OpenSSL command string

func (*OpenSSLHelper) SignCertificateWithOpenSSL ¶

func (h *OpenSSLHelper) SignCertificateWithOpenSSL(csrPEM, caCertPEM, caKeyPEM []byte, subject, san string) ([]byte, error)

SignCertificateWithOpenSSL signs a certificate using OpenSSL CA

func (*OpenSSLHelper) SignDataWithOpenSSL ¶

func (h *OpenSSLHelper) SignDataWithOpenSSL(data, privateKeyPEM []byte, algorithm string) ([]byte, error)

SignDataWithOpenSSL signs data using OpenSSL

func (*OpenSSLHelper) SignDataWithOpenSSLCMS ¶ added in v1.14.0

func (h *OpenSSLHelper) SignDataWithOpenSSLCMS(data, privateKeyPEM, certPEM []byte, hashAlg string) ([]byte, error)

SignDataWithOpenSSLCMS creates a CMS signature using OpenSSL cms command

func (*OpenSSLHelper) SignWithOpenSSL ¶ added in v1.15.0

func (h *OpenSSLHelper) SignWithOpenSSL(data []byte, privateKeyPEM []byte, hashAlg string) ([]byte, error)

SignWithOpenSSL creates a signature using OpenSSL pkeyutl

func (*OpenSSLHelper) TempDir ¶ added in v1.16.0

func (h *OpenSSLHelper) TempDir() string

TempDir returns the temporary directory path

func (*OpenSSLHelper) TempFile ¶

func (h *OpenSSLHelper) TempFile(name string, content []byte) string

TempFile creates a temporary file with the given content

func (*OpenSSLHelper) ValidateAuthorizedKeysFormat ¶

func (h *OpenSSLHelper) ValidateAuthorizedKeysFormat(publicKeyData []byte) error

ValidateAuthorizedKeysFormat checks if a public key works in authorized_keys format

func (*OpenSSLHelper) ValidateCMSWithOpenSSL ¶ added in v1.16.0

func (h *OpenSSLHelper) ValidateCMSWithOpenSSL(cmsData []byte) error

ValidateCMSWithOpenSSL validates CMS format using OpenSSL

func (*OpenSSLHelper) ValidateCertificateWithOpenSSL ¶

func (h *OpenSSLHelper) ValidateCertificateWithOpenSSL(certPEM []byte) error

ValidateCertificateWithOpenSSL validates a certificate using OpenSSL

func (*OpenSSLHelper) ValidatePrivateKeyWithOpenSSL ¶

func (h *OpenSSLHelper) ValidatePrivateKeyWithOpenSSL(privateKeyPEM []byte, algorithm string) error

ValidatePrivateKeyWithOpenSSL validates a private key using OpenSSL

func (*OpenSSLHelper) ValidatePublicKeyWithOpenSSL ¶

func (h *OpenSSLHelper) ValidatePublicKeyWithOpenSSL(publicKeyPEM []byte) error

ValidatePublicKeyWithOpenSSL validates a public key using OpenSSL

func (*OpenSSLHelper) ValidateSSHPrivateKeyWithSSHKeygen ¶

func (h *OpenSSLHelper) ValidateSSHPrivateKeyWithSSHKeygen(privateKeyData []byte) error

ValidateSSHPrivateKeyWithSSHKeygen validates an SSH private key using ssh-keygen

func (*OpenSSLHelper) ValidateSSHPublicKeyWithSSHKeygen ¶

func (h *OpenSSLHelper) ValidateSSHPublicKeyWithSSHKeygen(publicKeyData []byte) error

ValidateSSHPublicKeyWithSSHKeygen validates an SSH public key using ssh-keygen

func (*OpenSSLHelper) ValidateSignatureFormatWithOpenSSL ¶ added in v1.14.0

func (h *OpenSSLHelper) ValidateSignatureFormatWithOpenSSL(signatureData []byte, format string) error

ValidateSignatureFormatWithOpenSSL validates signature format using OpenSSL

func (*OpenSSLHelper) VerifyAlgorithmSignatureWithOpenSSL ¶ added in v1.15.0

func (h *OpenSSLHelper) VerifyAlgorithmSignatureWithOpenSSL(data, signature, publicKeyPEM []byte, algorithm, hashAlg string) error

VerifyAlgorithmSignatureWithOpenSSL verifies a signature using OpenSSL with specific algorithm

func (*OpenSSLHelper) VerifyCertificateChainWithOpenSSL ¶

func (h *OpenSSLHelper) VerifyCertificateChainWithOpenSSL(certPEM, caCertPEM []byte) error

VerifyCertificateChainWithOpenSSL verifies certificate chain using OpenSSL

func (*OpenSSLHelper) VerifyDetachedPKCS7SignatureWithOpenSSL ¶ added in v1.14.0

func (h *OpenSSLHelper) VerifyDetachedPKCS7SignatureWithOpenSSL(data, signatureData []byte) error

VerifyDetachedPKCS7SignatureWithOpenSSL verifies a detached PKCS#7 signature using OpenSSL

func (*OpenSSLHelper) VerifyECDSASignatureInterop ¶ added in v1.15.0

func (h *OpenSSLHelper) VerifyECDSASignatureInterop(data []byte, derSignature []byte, publicKey *ecdsa.PublicKey) (bool, error)

VerifyECDSASignatureInterop verifies ECDSA signature with proper DER parsing

func (*OpenSSLHelper) VerifyPKCS7SignatureWithCertificateChainWithOpenSSL ¶ added in v1.14.0

func (h *OpenSSLHelper) VerifyPKCS7SignatureWithCertificateChainWithOpenSSL(data, signatureData, caCertPEM []byte) error

VerifyPKCS7SignatureWithCertificateChainWithOpenSSL verifies PKCS#7 signature with certificate chain

func (*OpenSSLHelper) VerifyPKCS7SignatureWithOpenSSL ¶ added in v1.14.0

func (h *OpenSSLHelper) VerifyPKCS7SignatureWithOpenSSL(data, signatureData []byte) error

VerifyPKCS7SignatureWithOpenSSL verifies a PKCS#7 signature using OpenSSL

func (*OpenSSLHelper) VerifyRawSignatureWithOpenSSL ¶ added in v1.14.0

func (h *OpenSSLHelper) VerifyRawSignatureWithOpenSSL(data []byte, signature []byte, publicKeyPEM []byte, hashAlg string) error

VerifyRawSignatureWithOpenSSL verifies a raw signature using OpenSSL pkeyutl

func (*OpenSSLHelper) VerifySignatureWithOpenSSL ¶

func (h *OpenSSLHelper) VerifySignatureWithOpenSSL(data, signature, publicKeyPEM []byte, algorithm string) error

VerifySignatureWithOpenSSL verifies a signature using OpenSSL

func (*OpenSSLHelper) WriteFile ¶ added in v1.16.0

func (h *OpenSSLHelper) WriteFile(filepath string, content []byte) error

WriteFile writes content to a file

type TestKeyPair ¶

type TestKeyPair struct {
	Algorithm  string
	KeySize    int
	CurveName  string
	PrivateKey interface{}
	PublicKey  interface{}
	PrivatePEM []byte
	PublicPEM  []byte
	PrivateDER []byte
	PublicDER  []byte
	TempDir    string
}

TestKeyPair represents a generated key pair for testing

func (*TestKeyPair) Cleanup ¶

func (tkp *TestKeyPair) Cleanup()

Cleanup removes temporary files created during testing

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL