~ubuntu-branches/ubuntu/vivid/golang/vivid

« back to all changes in this revision

Viewing changes to src/pkg/crypto/openpgp/packet/packet.go

  • Committer: Bazaar Package Importer
  • Author(s): Ondřej Surý
  • Date: 2011-08-03 17:04:59 UTC
  • mfrom: (14.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20110803170459-wzd99m3567y80ila
Tags: 1:59-1
* Imported Upstream version 59
* Refresh patches to a new release
* Fix FTBFS on ARM (Closes: #634270)
* Update version.bash to work with Debian packaging and not hg
  repository

Show diffs side-by-side

added added

removed removed

Lines of Context:
372
372
        PubKeyAlgoRSA            PublicKeyAlgorithm = 1
373
373
        PubKeyAlgoRSAEncryptOnly PublicKeyAlgorithm = 2
374
374
        PubKeyAlgoRSASignOnly    PublicKeyAlgorithm = 3
375
 
        PubKeyAlgoElgamal        PublicKeyAlgorithm = 16
 
375
        PubKeyAlgoElGamal        PublicKeyAlgorithm = 16
376
376
        PubKeyAlgoDSA            PublicKeyAlgorithm = 17
377
377
)
378
378
 
 
379
// CanEncrypt returns true if it's possible to encrypt a message to a public
 
380
// key of the given type.
 
381
func (pka PublicKeyAlgorithm) CanEncrypt() bool {
 
382
        switch pka {
 
383
        case PubKeyAlgoRSA, PubKeyAlgoRSAEncryptOnly, PubKeyAlgoElGamal:
 
384
                return true
 
385
        }
 
386
        return false
 
387
}
 
388
 
 
389
// CanSign returns true if it's possible for a public key of the given type to
 
390
// sign a message.
 
391
func (pka PublicKeyAlgorithm) CanSign() bool {
 
392
        switch pka {
 
393
        case PubKeyAlgoRSA, PubKeyAlgoRSASignOnly, PubKeyAlgoDSA:
 
394
                return true
 
395
        }
 
396
        return false
 
397
}
 
398
 
379
399
// CipherFunction represents the different block ciphers specified for OpenPGP. See
380
400
// http://www.iana.org/assignments/pgp-parameters/pgp-parameters.xhtml#pgp-parameters-13
381
401
type CipherFunction uint8
387
407
        CipherAES256 CipherFunction = 9
388
408
)
389
409
 
390
 
// keySize returns the key size, in bytes, of cipher.
391
 
func (cipher CipherFunction) keySize() int {
 
410
// KeySize returns the key size, in bytes, of cipher.
 
411
func (cipher CipherFunction) KeySize() int {
392
412
        switch cipher {
393
413
        case CipherCAST5:
394
414
                return cast5.KeySize