PrivateKey.php 899 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /*
  3. * This file is part of the PHPASN1 library.
  4. *
  5. * Copyright © Friedrich Große <friedrich.grosse@gmail.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace FG\X509;
  11. use FG\ASN1\OID;
  12. use FG\ASN1\Universal\NullObject;
  13. use FG\ASN1\Universal\Sequence;
  14. use FG\ASN1\Universal\BitString;
  15. use FG\ASN1\Universal\ObjectIdentifier;
  16. class PrivateKey extends Sequence
  17. {
  18. /**
  19. * @param string $hexKey
  20. * @param \FG\ASN1\ASNObject|string $algorithmIdentifierString
  21. */
  22. public function __construct($hexKey, $algorithmIdentifierString = OID::RSA_ENCRYPTION)
  23. {
  24. parent::__construct(
  25. new Sequence(
  26. new ObjectIdentifier($algorithmIdentifierString),
  27. new NullObject()
  28. ),
  29. new BitString($hexKey)
  30. );
  31. }
  32. }